LaferriereJC commited on
Commit
5696f41
·
verified ·
1 Parent(s): 0101874

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -1
README.md CHANGED
@@ -51,4 +51,29 @@ decoded_output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
51
  print(decoded_output)
52
  ```
53
 
54
- Once upon a time, the world is changing.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  print(decoded_output)
52
  ```
53
 
54
+ Once upon a time, the world is changing.
55
+
56
+
57
+ ```
58
+ # Now, you can use the model and tokenizer for inference
59
+ input_text = "The Fulton County Grand Fair was set for Friday at"
60
+ inputs = tokenizer(input_text, return_tensors="pt").to('cuda')
61
+
62
+ # Generate output tokens using the model with repetition controls
63
+ output_ids = model.generate(
64
+ **inputs,
65
+ max_length=256, # Max tokens to generate
66
+ repetition_penalty=1.2, # Penalize repeated words
67
+ no_repeat_ngram_size=3, # Prevent 3-gram repetitions
68
+ temperature=0.9, # Adjust randomness (lower means more deterministic)
69
+ top_k=50, # Only sample from top 50 tokens
70
+ top_p=0.9 # Use nucleus sampling to control diversity
71
+ )
72
+
73
+ # Decode the generated token IDs back into text
74
+ decoded_output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
75
+
76
+ # Print the generated output text
77
+ print(decoded_output)
78
+ ```
79
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62578ad28c6638f8a93e8856/dpDosrj8gUt2puqx5TLt_.png)