sample code throws TypeError: can only concatenate str (not "dict") to str
#82
by
alxmke
- opened
The example given at https://huggingface.co/microsoft/Phi-3-mini-128k-instruct#sample-inference-code causes a TypeError: can only concatenate str (not "dict") to str
for me at output = pipe(messages, **generation_args)
(line 33).
This is the full error:
TypeError Traceback (most recent call last)
Cell In[11], line 1
----> 1 output = pipe(messages, **generation_args)
2 print(output[0]['generated_text'])
File c:\Users\Alex\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\pipelines\text_generation.py:208, in TextGenerationPipeline.__call__(self, text_inputs, **kwargs)
167 def __call__(self, text_inputs, **kwargs):
168 """
169 Complete the prompt(s) given as inputs.
170
(...)
206 ids of the generated text.
207 """
--> 208 return super().__call__(text_inputs, **kwargs)
File c:\Users\Alex\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\pipelines\base.py:1121, in Pipeline.__call__(self, inputs, num_workers, batch_size, *args, **kwargs)
1117 if can_use_iterator:
1118 final_iterator = self.get_iterator(
1119 inputs, num_workers, batch_size, preprocess_params, forward_params, postprocess_params
1120 )
-> 1121 outputs = list(final_iterator)
1122 return outputs
1123 else:
...
215 )
216 inputs["prompt_text"] = prompt_text
218 if handle_long_generation == "hole":
TypeError: can only concatenate str (not "dict") to str```
nguyenbh
changed discussion status to
closed