ollama / ollama-python

Ollama Python library
https://ollama.com
MIT License
2.71k stars 223 forks source link

chat and cli chat get different outputs when using llava #65

Closed iplayfast closed 4 months ago

iplayfast commented 4 months ago

Looking at photo's from the cli gives accurate results, from ollama.chat hallucinates.

from cli

ollama run llava
examine picture at IMG_8798.JPG
 The image you've provided appears to be a photograph of two people, likely taken at an indoor venue. Both individuals are smiling and seem to be enjoying
themselves, possibly in a social setting like a restaurant or bar.

The person on the left is wearing glasses and what looks to be a patterned top, while the individual on the right has a plaid shirt and balding hair with 
some gray strands visible at the sides. They both appear to be older adults and could be family members or close friends. Their relative positions suggest
they are posing for the photo together.

The background of the image indicates that they might be in a casual setting, as there's furniture visible behind them, which could imply a dining area or
similar environment within an indoor venue. The lighting suggests it may have been taken during daylight hours, and the overall mood of the image is 
cheerful and positive, reflecting the enjoyment of their time together. 

python script

import ollama

#emb = ollama.embeddings(model='llava', prompt='examine picture at IMG_8798.JPG')
#print(emb)

chat = ollama.chat(model='llava', messages=[{'role': 'user', 'content': 'examine picture at IMG_8798.JPG'}])
print(chat)

python result

chris@FORGE:~/ai/aiprojects/photos$ python app.py 
{'model': 'llava', 'created_at': '2024-02-14T14:28:15.937502787Z', 'message': {'role': 'assistant', 'content': ' The image you\'ve provided appears to be a photograph of an indoor setting, possibly a room in a building. There is not much detail visible in the image, but here are some observations:\n\n* The photo has a watermark or text overlay that says "IMG_8798.JPG," which suggests that it was taken with a digital camera and saved as a JPEG file.\n* The lighting in the room is artificial, likely from ceiling lights or lamps, and there are no windows or other natural light sources visible.\n* There is some indistinct text on the wall to the left, but it\'s not clear enough to read.\n* The flooring looks like a type of carpet or rug, but it\'s difficult to make out any specific patterns or colors due to the resolution and angle of the photo.\n* In the foreground, there appears to be a white object with some reflective quality, which could be a piece of furniture or equipment, but again, it\'s hard to make out any specific details.\n\nOverall, without more context or a higher-resolution image, it\'s difficult to provide a more detailed analysis of the photograph. '}, 'done': True, 'total_duration': 2057330080, 'load_duration': 239573, 'prompt_eval_count': 20, 'prompt_eval_duration': 65368000, 'eval_count': 253, 'eval_duration': 1991285000}
chris@FORGE:~/ai/aiprojects/photos$ python app.py 
{'model': 'llava', 'created_at': '2024-02-14T14:31:59.414448944Z', 'message': {'role': 'assistant', 'content': ' The image appears to be a photograph, but the resolution is too low for me to provide any specific details about the content of the photo. If you can provide a higher-resolution version or more information about the image, I may be able to assist you further. '}, 'done': True, 'total_duration': 481256887, 'load_duration': 153712, 'prompt_eval_count': 20, 'prompt_eval_duration': 70449000, 'eval_count': 56, 'eval_duration': 409739000}
chris@FORGE:~/ai/aiprojects/photos$ python app.py 
{'model': 'llava', 'created_at': '2024-02-14T14:32:37.097980175Z', 'message': {'role': 'assistant', 'content': " The image you've provided is a bit blurry, but I'll do my best to describe what I can see. It appears to be a photograph of an object or a scene with a dark background and some lighter elements that could possibly be stars or lights. Without more context, it's difficult to determine the exact nature of the image. If you have any specific questions about the photo or need help with something related to it, please let me know! "}, 'done': True, 'total_duration': 726986598, 'load_duration': 142955, 'prompt_eval_duration': 20846000, 'eval_count': 96, 'eval_duration': 705631000}
chris@FORGE:~/ai/aiprojects/photos$ python app.py 
{'model': 'llava', 'created_at': '2024-02-14T14:32:44.507058654Z', 'message': {'role': 'assistant', 'content': " Sure, I can help you with that. The image is a JPEG file and it appears to be an everyday photograph of a person standing outdoors. It's not clear what the individual is doing or where they are, but they seem to be dressed casually.\n\nIf you have any specific questions about the image or need further details, feel free to let me know! "}, 'done': True, 'total_duration': 589823820, 'load_duration': 159140, 'prompt_eval_duration': 7421000, 'eval_count': 80, 'eval_duration': 581882000}
chris@FORGE:~/ai/aiprojects/photos$ 
iplayfast commented 4 months ago

https://github.com/ollama/ollama-python/issues/66