Skip to content

Commit

Permalink
Add modelscope to qwenvl
Browse files Browse the repository at this point in the history
  • Loading branch information
haixuanTao committed Oct 13, 2024
1 parent 9e495c5 commit 0e9a3fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion node-hub/dora-qwenvl/dora_qwenvl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@
import numpy as np
import pyarrow as pa
from PIL import Image
from pathlib import Path
import cv2

DEFAULT_PATH = "Qwen/Qwen2-VL-2B-Instruct"
CUSTOM_MODEL_PATH = os.getenv("CUSTOM_MODEL_PATH", DEFAULT_PATH)

MODEL_NAME_OR_PATH = os.getenv("MODEL_NAME_OR_PATH", DEFAULT_PATH)

if bool(os.getenv("MODELSCOPE")) is True:
from modelscope import snapshot_download

if not Path(MODEL_NAME_OR_PATH).exists():
CUSTOM_MODEL_PATH = snapshot_download(MODEL_NAME_OR_PATH)

DEFAULT_QUESTION = os.getenv(
"DEFAULT_QUESTION",
"Describe this image",
Expand Down
1 change: 1 addition & 0 deletions node-hub/dora-qwenvl/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ transformers = "^4.45"
qwen-vl-utils = "^0.0.2"
accelerate = "^0.33"
opencv-python = ">= 4.1.1"
modelscope = "^1.18.1"
# flash_attn = "^2.6.1" # Install using: pip install -U flash-attn --no-build-isolation


Expand Down

0 comments on commit 0e9a3fc

Please sign in to comment.