seg fault when calling from python
#3
by
nawal2
- opened
Using llama.cpp: 799fc2268989482054944c902874cca76337580f Wed Dec 20 15:41:22 2023
./server -m models/obsidian-f16.gguf --mmproj models/mmproj-obsidian-f16.gguf --host 0.0.0.0
import requests
import json
import base64
image_path = '/home/nawal/IMG_20231210_220649_640x480.png'
with open(image_path, 'rb') as image_file:
encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
url = 'http://192.168.0.52:8080/completion'
headers = { 'Content-Type': 'application/json' }
data = {
'prompt': '''
<|im_start|>user
What does this image contain?\n<image>
###
<|im_start|>assistant''',
'n_predict': 512,
'top_k': 40,
'temperature': 0.2,
'image_data': [{'data': encoded_string, 'id': 1}]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
# Check the response
if response.status_code == 200:
print('Request successful!')
print(response.json()) # This will print the response content
else:
print('Request failed with status code:', response.status_code)
This causes the server to crash:
{"timestamp":1703167163,"level":"INFO","function":"log_server_request","line":2608,"message":"request","remote_addr":"192.168.0.10","remote_port":53312,"status":200,"method":"GET","path":"/completion.js","params":{}}
slot 0 - image loaded [id: 1] resolution (640 x 480)
slot 0 is processing [task id: 4]
slot 0 : kv cache rm - [0, end)
slot 0 : we have to evaluate at least 1 token to generate logits
slot 0 - encoding image [id: 1]
Segmentation fault (core dumped)
Nope, I should have used [img-1] instead of . Closing.
nawal2
changed discussion status to
closed