Skip to content

Commit

Permalink
Update generate_answer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirAgassi committed Nov 24, 2024
1 parent 624560b commit 5af4c90
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion backend/generate_answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ def get_device():

def generate_initial_note(page_content, model, tokenizer):
inputs = tokenizer(f"Generate notes for the given content: {page_content}", return_tensors="pt")
outputs = model.generate(**inputs)
outputs = model.generate(
**inputs,
max_length=2048,
pad_token_id=tokenizer.eos_token_id,
num_return_sequences=1,
temperature=0.7
)
final_output = ""
for output in outputs:
final_output += tokenizer.decode(output, skip_special_tokens=True)
Expand Down

0 comments on commit 5af4c90

Please sign in to comment.