Skip to content

Commit 31a5fb0

Browse files
authored
Update hf.py
1 parent 4b1414f commit 31a5fb0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

dsp/modules/hf.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,8 @@ def _generate(self, prompt, **kwargs):
168168
print("Failed to extract 'content' from the prompt.")
169169
inputs = self.tokenizer(prompt, return_tensors="pt").to(self.device)
170170

171-
if 'temperature' in kwargs:
172-
if kwargs['temperature'] == 0.0:
173-
kwargs['do_sample'] = False
171+
if 'temperature' in kwargs and kwargs['temperature'] == 0.0:
172+
kwargs['do_sample'] = False
174173

175174
# print(kwargs)
176175
outputs = self.model.generate(**inputs, **kwargs)

0 commit comments

Comments
 (0)