Closed Ashvini-Kumar-Sharma closed 3 months ago
Should work with Phi3-vision, but running into errors
from outlines import models from outlines import generate model = models.transformers("microsoft/Phi-3-vision-128k-instruct", model_kwargs={'trust_remote_code':True, 'device_map':device, '_attn_implementation':'eager'}) schema = """ { "title": "User", "type": "object", "properties": { "FirstName": {"type": "string"}, "LastName": {"type": "string"}, "ID": {"type": "integer"} }, "required": ["FirstName", "LastName", "LastName"] } """ generator = generate.text(model, schema) generator( "'<|user|>\n<|image_1|>\nExtract detailed JSON<|end|>\n<|assistant|>\n", [Image.open(impath)] )
FirstName: "John" LastName: "Doe" ID: "12345678"
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[170], line 2 1 generator = generate.text(model) ----> 2 generator( 3 "'<|user|>\n<|image_1|>\nExtract detailed JSON<|end|>\n<|assistant|>\n", 4 [Image.open(impath)] 5 6 ) File ~/miniconda3/envs/all_models/lib/python3.8/site-packages/outlines/generate/api.py:213, in SequenceGenerator.__call__(self, prompts, max_tokens, stop_at, rng) 209 token_ids = last_state.token_ids 210 generated_token_ids = self.get_generated_token_ids( 211 prompt_token_ids, token_ids 212 ) --> 213 if max_tokens and len(generated_token_ids[0]) >= max_tokens: 214 break 215 if stop_sequences and self.is_stop_sequence_found( 216 self.tokenizer.decode(generated_token_ids), stop_sequences 217 ): TypeError: '>=' not supported between instances of 'int' and 'list'
Version information
No response
Issue resolved as picked wrong library transformers_vision should be used.
Describe the issue as clearly as possible:
Should work with Phi3-vision, but running into errors
Steps/code to reproduce the bug:
Expected result:
Error message:
Outlines/Python version information:
Version information
Context for the issue:
No response