cydxg's picture
Upload extra needed files
a2fedce verified
from pathlib import Path
import requests
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
if not Path("ov_qwen2_vl.py").exists():
r = requests.get(url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/notebooks/qwen2-vl/ov_qwen2_vl.py")
open("ov_qwen2_vl.py", "w").write(r.text)
if not Path("notebook_utils.py").exists():
r = requests.get(url="https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py")
open("notebook_utils.py", "w").write(r.text)
from ov_qwen2_vl import model_selector
model_id = model_selector()
print(model_id)
print(f"Selected {model_id.value}")
pt_model_id = model_id.value
model_dir = Path(pt_model_id.split("/")[-1])
from ov_qwen2_vl import convert_qwen2vl_model
# uncomment these lines to see model conversion code
# convert_qwen2vl_model??
import nncf
compression_configuration = {
"mode": nncf.CompressWeightsMode.INT4_ASYM,
"group_size": 32,
"ratio": 1.0,
}
convert_qwen2vl_model(pt_model_id, model_dir, compression_configuration)