jatingocodeo commited on
Commit
8490de0
·
verified ·
1 Parent(s): 9ebfecb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -59,16 +59,14 @@ Description: """
59
  add_special_tokens=True
60
  )
61
 
62
- # Calculate minimum length to ensure we generate new tokens
63
- min_length = inputs['input_ids'].shape[1] + 20
64
 
65
  # Generate response
66
  with torch.no_grad():
67
  outputs = model.generate(
68
  input_ids=inputs['input_ids'],
69
  attention_mask=inputs['attention_mask'],
70
- max_length=max(min_length, max_length), # Ensure max_length is greater than input length
71
- min_length=min_length,
72
  temperature=temperature,
73
  top_p=top_p,
74
  do_sample=True,
 
59
  add_special_tokens=True
60
  )
61
 
62
+ input_length = inputs['input_ids'].shape[1]
 
63
 
64
  # Generate response
65
  with torch.no_grad():
66
  outputs = model.generate(
67
  input_ids=inputs['input_ids'],
68
  attention_mask=inputs['attention_mask'],
69
+ max_new_tokens=max_length, # Changed to max_new_tokens
 
70
  temperature=temperature,
71
  top_p=top_p,
72
  do_sample=True,