code: def check_perplexities(self, perplexities):
          
          usable_perplexities = []
          for perplexity in sorted(perplexities):
              if 3 * perplexity > self.n_samples - 1:
                  new_perplexity = (self.n_samples - 1) / 3
  
                  if new_perplexity in usable_perplexities:
                      log.warning(
                          "Perplexity value %d is too high. Dropping "
                          "because the max perplexity is already in the "
                          "list." % perplexity
                      )
                  else:
                      usable_perplexities.append(new_perplexity)
                      log.warning(
                          "Perplexity value %d is too high. Using "
                          "perplexity %.2f instead" % (perplexity, new_perplexity)
                      )
              else:
                  usable_perplexities.append(perplexity)
  
          return usable_perplexities
docs: Check and correct/truncate perplexities.
  
          If a perplexity is too large, it is corrected to the largest allowed
          value. It is then inserted into the list of perplexities only if that
          value doesn't already exist in the list.