Created
December 24, 2020 09:27
-
-
Save GeorgeDittmar/1415b38df3bef2900940fd44993dc3b9 to your computer and use it in GitHub Desktop.
huggingface text generation call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
generated_text_samples = model.generate( | |
input_ids, | |
max_length=150, | |
num_return_sequences=5, | |
no_repeat_ngram_size=2, | |
repetition_penalty=1.5, | |
top_p=0.92, | |
temperature=.85, | |
do_sample=True, | |
top_k=125, | |
early_stopping=True | |
) | |
#Print output for each sequence generated above | |
for i, beam in enumerate(beam_output): | |
print("{}: {}".format(i,tokenizer.decode(beam, skip_special_tokens=True))) | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment