Workpam commited on
Commit
130262d
·
verified ·
1 Parent(s): 15574a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -19,9 +19,12 @@ def generate_alt_text(files, max_new_tokens):
19
  out = captioner(
20
  img,
21
  generate_kwargs={
22
- "max_new_tokens": int(max_new_tokens),
23
- "num_beams": 4,
24
- "no_repeat_ngram_size": 2
 
 
 
25
  }
26
  )
27
  caption = out[0]["generated_text"].strip().capitalize()
 
19
  out = captioner(
20
  img,
21
  generate_kwargs={
22
+ "max_new_tokens": int(max_new_tokens),
23
+ "num_beams": 4, # You can still use num_beams with sampling, it creates diverse beams
24
+ "no_repeat_ngram_size": 2,
25
+ "do_sample": True,
26
+ "temperature": 0.9, # Experiment with this value
27
+ "top_k": 50 # Or top_p=0.95
28
  }
29
  )
30
  caption = out[0]["generated_text"].strip().capitalize()