danaaubakirova HF staff commited on
Commit
be203d9
1 Parent(s): b733be1

Update model_worker.py

Browse files

Currently, do_sample is forced to be False and top_p is commented out, resulting in identical outputs each time, which is concerning. For more varied and realistic outputs, I suggest enabling sampling by setting do_sample=True and adjusting top_p as needed. Thanks!

Files changed (1) hide show
  1. model_worker.py +2 -2
model_worker.py CHANGED
@@ -113,7 +113,7 @@ class ModelWorker:
113
  max_new_tokens = min(int(params.get("max_new_tokens", 256)), 1024)
114
  stop_str = params.get("stop", None)
115
  # do_sample = True if temperature > 0.001 else False
116
- do_sample = False
117
 
118
  input_ids = tokenizer_image_token(prompt, tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).to(self.device)
119
  keywords = [stop_str]
@@ -131,7 +131,7 @@ class ModelWorker:
131
  inputs=input_ids,
132
  do_sample=do_sample,
133
  temperature=temperature,
134
- # top_p=top_p,
135
  max_new_tokens=max_new_tokens,
136
  streamer=streamer,
137
  stopping_criteria=[stopping_criteria],
 
113
  max_new_tokens = min(int(params.get("max_new_tokens", 256)), 1024)
114
  stop_str = params.get("stop", None)
115
  # do_sample = True if temperature > 0.001 else False
116
+ do_sample = True
117
 
118
  input_ids = tokenizer_image_token(prompt, tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).to(self.device)
119
  keywords = [stop_str]
 
131
  inputs=input_ids,
132
  do_sample=do_sample,
133
  temperature=temperature,
134
+ top_p=top_p,
135
  max_new_tokens=max_new_tokens,
136
  streamer=streamer,
137
  stopping_criteria=[stopping_criteria],