Update model_worker.py

#4
by danaaubakirova HF staff - opened
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],