model_id = "llava-hf/llava-1.5-7b-hf"
pipe = pipeline("image-to-text",
model=model_id,
model_kwargs={})
def test_single_image():
"""
Test the model with a single image from the dataset.
"""
# Load just one image
images_data = load_test_images(num_images=1)
if not images_data:
print("No images found in the dataset")
return
# Get the first image
image_data = images_data[0]
print(f"Testing with image {image_data['index']}")
print(f"URL: {image_data['image_url']}")
print("\nOriginal hierarchical caption:")
print(image_data['hierarchical_caption'])
# Download and process the image
image = get_image_from_url(image_data['image_url'])
if image is None:
print("Failed to download image")
return
print("\nGenerating caption...")
generated_caption = generate_hierarchical_caption(image, pipe)
if generated_caption is None:
print("Failed to generate caption")
return
print("\nGenerated hierarchical caption:")
print(generated_caption)
print("\nComparison:")
print("-" * 80)
print("Original:", image_data['hierarchical_caption'])
print("Generated:", generated_caption)
< /code>
Исключение: < /p>
ValueError: Image features and image tokens do not match: tokens: 1, features 576
< /code>
Я продолжаю получать эту ошибку. Пожалуйста, помогите! Не уверен, что делать. Я пытался генерировать подпись, но продолжаю столкнуться с этой ошибкой. Кто -нибудь еще видел эту ошибку? Есть идеи, что делать? Я очень ценю это.
Подробнее здесь: https://stackoverflow.com/questions/796 ... ures-llava
Несоответственное количество токенов и особенностей: llava ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Detectron2 - Извлечение особенностей области на пороге обнаружения объекта.
Anonymous » » в форуме Python - 0 Ответы
- 7 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Claude/Sonnet Python API - больше токенов замораживает, меньше токенов усечны
Anonymous » » в форуме Python - 0 Ответы
- 5 Просмотры
-
Последнее сообщение Anonymous
-