cleanup and files added
This commit is contained in:
35
qt_app_pyside1/llava_openvino_model/.gitattributes
vendored
Normal file
35
qt_app_pyside1/llava_openvino_model/.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
112
qt_app_pyside1/llava_openvino_model/README.md
Normal file
112
qt_app_pyside1/llava_openvino_model/README.md
Normal file
@@ -0,0 +1,112 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
tags:
|
||||
- vision
|
||||
- image-text-to-text
|
||||
language:
|
||||
- en
|
||||
pipeline_tag: image-text-to-text
|
||||
inference: true
|
||||
base_model:
|
||||
- llava-hf/llava-v1.6-mistral-7b-hf
|
||||
base_model_relation: quantized
|
||||
---
|
||||
|
||||
# llava-v1.6-mistral-7b-hf-int8-ov
|
||||
|
||||
* Model creator: [llava-hf](https://huggingface.co/llava-hf)
|
||||
* Original model: [llava-v1.6-mistral-7b-hf](https://huggingface.co/llava-hf/llava-v1.6-mistral-7b-hf)
|
||||
|
||||
## Description
|
||||
|
||||
This is [llava-hf/llava-v1.6-mistral-7b-hf](https://huggingface.co/llava-hf/llava-v1.6-mistral-7b-hf) model converted to the [OpenVINO™ IR](https://docs.openvino.ai/2025/documentation/openvino-ir-format.html) (Intermediate Representation) format with weights compressed to INT8 by [NNCF](https://github.com/openvinotoolkit/nncf).
|
||||
|
||||
|
||||
## Quantization Parameters
|
||||
|
||||
Weight compression was performed using `nncf.compress_weights` with the following parameters:
|
||||
|
||||
* mode: **INT8_ASYM**
|
||||
* ratio: **1.0**
|
||||
|
||||
|
||||
## Compatibility
|
||||
|
||||
The provided OpenVINO™ IR model is compatible with:
|
||||
|
||||
* OpenVINO version 2025.2.0 and higher
|
||||
* Optimum Intel 1.26.0 and higher
|
||||
|
||||
|
||||
## Running Model Inference with [OpenVINO GenAI](https://github.com/openvinotoolkit/openvino.genai)
|
||||
|
||||
1. Install packages required for using OpenVINO GenAI.
|
||||
```
|
||||
pip install --pre -U --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release openvino openvino-tokenizers openvino-genai
|
||||
|
||||
pip install huggingface_hub
|
||||
```
|
||||
|
||||
2. Download model from HuggingFace Hub
|
||||
|
||||
```
|
||||
import huggingface_hub as hf_hub
|
||||
|
||||
model_id = "OpenVINO/llava-v1.6-mistral-7b-hf-int8-ov"
|
||||
model_path = "llava-v1.6-mistral-7b-hf-int8-ov"
|
||||
|
||||
hf_hub.snapshot_download(model_id, local_dir=model_path)
|
||||
|
||||
```
|
||||
|
||||
1. Run model inference:
|
||||
|
||||
```
|
||||
import openvino_genai as ov_genai
|
||||
import requests
|
||||
from PIL import Image
|
||||
from io import BytesIO
|
||||
import numpy as np
|
||||
import openvino as ov
|
||||
|
||||
device = "CPU"
|
||||
pipe = ov_genai.VLMPipeline(model_path, device)
|
||||
|
||||
def load_image(image_file):
|
||||
if isinstance(image_file, str) and (image_file.startswith("http") or image_file.startswith("https")):
|
||||
response = requests.get(image_file)
|
||||
image = Image.open(BytesIO(response.content)).convert("RGB")
|
||||
else:
|
||||
image = Image.open(image_file).convert("RGB")
|
||||
image_data = np.array(image.getdata()).reshape(1, image.size[1], image.size[0], 3).astype(np.byte)
|
||||
return ov.Tensor(image_data)
|
||||
|
||||
prompt = "What is unusual on this picture?"
|
||||
|
||||
url = "https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/d5fbbd1a-d484-415c-88cb-9986625b7b11"
|
||||
image_tensor = load_image(url)
|
||||
|
||||
def streamer(subword: str) -> bool:
|
||||
print(subword, end="", flush=True)
|
||||
return False
|
||||
|
||||
pipe.start_chat()
|
||||
output = pipe.generate(prompt, image=image_tensor, max_new_tokens=100, streamer=streamer)
|
||||
pipe.finish_chat()
|
||||
```
|
||||
|
||||
More GenAI usage examples can be found in OpenVINO GenAI library [docs](https://github.com/openvinotoolkit/openvino.genai/blob/master/src/README.md) and [samples](https://github.com/openvinotoolkit/openvino.genai?tab=readme-ov-file#openvino-genai-samples)
|
||||
|
||||
|
||||
## Limitations
|
||||
|
||||
Check the original [model card](https://huggingface.co/llava-hf/llava-v1.6-mistral-7b-hf) for limitations.
|
||||
|
||||
## Legal information
|
||||
|
||||
The original model is distributed under [apache-2.0](https://huggingface.co/datasets/choosealicense/licenses/blob/main/markdown/apache-2.0.md) license. More details can be found in [original model card](https://huggingface.co/llava-hf/llava-v1.6-mistral-7b-hf).
|
||||
|
||||
## Disclaimer
|
||||
|
||||
Intel is committed to respecting human rights and avoiding causing or contributing to adverse impacts on human rights. See [Intel’s Global Human Rights Principles](https://www.intel.com/content/dam/www/central-libraries/us/en/documents/policy-human-rights.pdf). Intel’s products and software are intended only to be used in applications that do not cause or contribute to adverse impacts on human rights.
|
||||
|
||||
4
qt_app_pyside1/llava_openvino_model/added_tokens.json
Normal file
4
qt_app_pyside1/llava_openvino_model/added_tokens.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"<image>": 32000,
|
||||
"<pad>": 32001
|
||||
}
|
||||
3
qt_app_pyside1/llava_openvino_model/chat_template.json
Normal file
3
qt_app_pyside1/llava_openvino_model/chat_template.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"chat_template": "{% for message in messages %}{% if message['role'] == 'system' %}{{ '<<SYS>>\n' + message['content'][0]['text'] + '\n<</SYS>>\n\n' }}{% elif message['role'] == 'user' %}{{ '[INST] ' }}{# Render all images first #}{% for content in message['content'] | selectattr('type', 'equalto', 'image') %}{{ '<image>\n' }}{% endfor %}{# Render all text next #}{% for content in message['content'] | selectattr('type', 'equalto', 'text') %}{{ content['text'] }}{% endfor %}{{' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ ' ' + message['content'][0]['text'] + '</s> '}}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}"
|
||||
}
|
||||
4180
qt_app_pyside1/llava_openvino_model/config.json
Normal file
4180
qt_app_pyside1/llava_openvino_model/config.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"transformers_version": "4.51.3"
|
||||
}
|
||||
28
qt_app_pyside1/llava_openvino_model/openvino_config.json
Normal file
28
qt_app_pyside1/llava_openvino_model/openvino_config.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"dtype": "int8",
|
||||
"input_info": null,
|
||||
"optimum_version": "1.27.0",
|
||||
"quantization_config": {
|
||||
"all_layers": null,
|
||||
"backup_precision": null,
|
||||
"bits": 8,
|
||||
"dataset": null,
|
||||
"dtype": "int8",
|
||||
"gptq": null,
|
||||
"group_size": -1,
|
||||
"ignored_scope": null,
|
||||
"lora_correction": null,
|
||||
"num_samples": null,
|
||||
"processor": null,
|
||||
"quant_method": "default",
|
||||
"ratio": 1.0,
|
||||
"scale_estimation": null,
|
||||
"sensitivity_metric": null,
|
||||
"statistics_path": null,
|
||||
"sym": false,
|
||||
"tokenizer": null,
|
||||
"trust_remote_code": false
|
||||
},
|
||||
"save_onnx_model": false,
|
||||
"transformers_version": "4.51.3"
|
||||
}
|
||||
BIN
qt_app_pyside1/llava_openvino_model/openvino_detokenizer.bin
LFS
Normal file
BIN
qt_app_pyside1/llava_openvino_model/openvino_detokenizer.bin
LFS
Normal file
Binary file not shown.
BIN
qt_app_pyside1/llava_openvino_model/openvino_detokenizer.xml
LFS
Normal file
BIN
qt_app_pyside1/llava_openvino_model/openvino_detokenizer.xml
LFS
Normal file
Binary file not shown.
BIN
qt_app_pyside1/llava_openvino_model/openvino_language_model.bin
LFS
Normal file
BIN
qt_app_pyside1/llava_openvino_model/openvino_language_model.bin
LFS
Normal file
Binary file not shown.
BIN
qt_app_pyside1/llava_openvino_model/openvino_language_model.xml
LFS
Normal file
BIN
qt_app_pyside1/llava_openvino_model/openvino_language_model.xml
LFS
Normal file
Binary file not shown.
BIN
qt_app_pyside1/llava_openvino_model/openvino_text_embeddings_model.bin
LFS
Normal file
BIN
qt_app_pyside1/llava_openvino_model/openvino_text_embeddings_model.bin
LFS
Normal file
Binary file not shown.
BIN
qt_app_pyside1/llava_openvino_model/openvino_text_embeddings_model.xml
LFS
Normal file
BIN
qt_app_pyside1/llava_openvino_model/openvino_text_embeddings_model.xml
LFS
Normal file
Binary file not shown.
BIN
qt_app_pyside1/llava_openvino_model/openvino_tokenizer.bin
LFS
Normal file
BIN
qt_app_pyside1/llava_openvino_model/openvino_tokenizer.bin
LFS
Normal file
Binary file not shown.
BIN
qt_app_pyside1/llava_openvino_model/openvino_tokenizer.xml
LFS
Normal file
BIN
qt_app_pyside1/llava_openvino_model/openvino_tokenizer.xml
LFS
Normal file
Binary file not shown.
BIN
qt_app_pyside1/llava_openvino_model/openvino_vision_embeddings_model.bin
LFS
Normal file
BIN
qt_app_pyside1/llava_openvino_model/openvino_vision_embeddings_model.bin
LFS
Normal file
Binary file not shown.
BIN
qt_app_pyside1/llava_openvino_model/openvino_vision_embeddings_model.xml
LFS
Normal file
BIN
qt_app_pyside1/llava_openvino_model/openvino_vision_embeddings_model.xml
LFS
Normal file
Binary file not shown.
52
qt_app_pyside1/llava_openvino_model/preprocessor_config.json
Normal file
52
qt_app_pyside1/llava_openvino_model/preprocessor_config.json
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"aspect_ratio_setting": "anyres",
|
||||
"crop_size": {
|
||||
"height": 336,
|
||||
"width": 336
|
||||
},
|
||||
"do_center_crop": true,
|
||||
"do_convert_rgb": true,
|
||||
"do_normalize": true,
|
||||
"do_pad": true,
|
||||
"do_rescale": true,
|
||||
"do_resize": true,
|
||||
"image_grid_pinpoints": [
|
||||
[
|
||||
336,
|
||||
672
|
||||
],
|
||||
[
|
||||
672,
|
||||
336
|
||||
],
|
||||
[
|
||||
672,
|
||||
672
|
||||
],
|
||||
[
|
||||
1008,
|
||||
336
|
||||
],
|
||||
[
|
||||
336,
|
||||
1008
|
||||
]
|
||||
],
|
||||
"image_mean": [
|
||||
0.48145466,
|
||||
0.4578275,
|
||||
0.40821073
|
||||
],
|
||||
"image_processor_type": "LlavaNextImageProcessor",
|
||||
"image_std": [
|
||||
0.26862954,
|
||||
0.26130258,
|
||||
0.27577711
|
||||
],
|
||||
"processor_class": "LlavaNextProcessor",
|
||||
"resample": 3,
|
||||
"rescale_factor": 0.00392156862745098,
|
||||
"size": {
|
||||
"shortest_edge": 336
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"image_token": "<image>",
|
||||
"num_additional_image_tokens": 1,
|
||||
"patch_size": 14,
|
||||
"processor_class": "LlavaNextProcessor",
|
||||
"vision_feature_select_strategy": "default"
|
||||
}
|
||||
31
qt_app_pyside1/llava_openvino_model/special_tokens_map.json
Normal file
31
qt_app_pyside1/llava_openvino_model/special_tokens_map.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"bos_token": {
|
||||
"content": "<s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"eos_token": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"image_token": "<image>",
|
||||
"pad_token": {
|
||||
"content": "<pad>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"unk_token": {
|
||||
"content": "<unk>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
268088
qt_app_pyside1/llava_openvino_model/tokenizer.json
Normal file
268088
qt_app_pyside1/llava_openvino_model/tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
qt_app_pyside1/llava_openvino_model/tokenizer.model
LFS
Normal file
BIN
qt_app_pyside1/llava_openvino_model/tokenizer.model
LFS
Normal file
Binary file not shown.
69
qt_app_pyside1/llava_openvino_model/tokenizer_config.json
Normal file
69
qt_app_pyside1/llava_openvino_model/tokenizer_config.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"add_bos_token": true,
|
||||
"add_eos_token": false,
|
||||
"add_prefix_space": null,
|
||||
"added_tokens_decoder": {
|
||||
"0": {
|
||||
"content": "<unk>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"1": {
|
||||
"content": "<s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"2": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"32000": {
|
||||
"content": "<image>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"32001": {
|
||||
"content": "<pad>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
}
|
||||
},
|
||||
"additional_special_tokens": [],
|
||||
"bos_token": "<s>",
|
||||
"chat_template": "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if message['role'] == 'user' %}{{ '[INST] ' + message['content'] + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + eos_token}}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}",
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "</s>",
|
||||
"extra_special_tokens": {
|
||||
"image_token": "<image>"
|
||||
},
|
||||
"image_token": "<image>",
|
||||
"legacy": true,
|
||||
"max_length": null,
|
||||
"model_max_length": 1000000000000000019884624838656,
|
||||
"pad_to_multiple_of": null,
|
||||
"pad_token": "<pad>",
|
||||
"pad_token_type_id": 0,
|
||||
"padding_side": "left",
|
||||
"processor_class": "LlavaNextProcessor",
|
||||
"sp_model_kwargs": {},
|
||||
"spaces_between_special_tokens": false,
|
||||
"tokenizer_class": "LlamaTokenizer",
|
||||
"unk_token": "<unk>",
|
||||
"use_default_system_prompt": false
|
||||
}
|
||||
Reference in New Issue
Block a user