Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,10 +19,10 @@ model = AutoModelForCausalLM.from_pretrained(model_name)
|
|
19 |
def generate_text(input_text):
|
20 |
inputs = tokenizer(input_text, return_tensors="pt")
|
21 |
#outputs = model.generate(inputs["input_ids"], max_length=256, num_return_sequences=1)
|
22 |
-
|
23 |
inputs["input_ids"],
|
24 |
-
num_return_sequences=1,
|
25 |
max_length=256, # Set max length for output
|
|
|
26 |
temperature=0.8, # Control randomness (higher is more random)
|
27 |
top_k=50, # Top-k sampling to limit vocabulary to top 50 choices
|
28 |
top_p=0.95, # Nucleus sampling to choose tokens with 95% cumulative probability
|
|
|
19 |
def generate_text(input_text):
|
20 |
inputs = tokenizer(input_text, return_tensors="pt")
|
21 |
#outputs = model.generate(inputs["input_ids"], max_length=256, num_return_sequences=1)
|
22 |
+
outputs = model.generate(
|
23 |
inputs["input_ids"],
|
|
|
24 |
max_length=256, # Set max length for output
|
25 |
+
num_return_sequences=1,
|
26 |
temperature=0.8, # Control randomness (higher is more random)
|
27 |
top_k=50, # Top-k sampling to limit vocabulary to top 50 choices
|
28 |
top_p=0.95, # Nucleus sampling to choose tokens with 95% cumulative probability
|