diff --git a/.github/workflows/node-hub-ci-cd.yml b/.github/workflows/node-hub-ci-cd.yml index 6ce41d301..2dd80bbb1 100644 --- a/.github/workflows/node-hub-ci-cd.yml +++ b/.github/workflows/node-hub-ci-cd.yml @@ -141,7 +141,7 @@ jobs: if [[ -f "Cargo.toml" && -f "pyproject.toml" ]]; then echo "Publishing $dir using maturin..." pip3 install "maturin[patchelf]" - maturin publish --skip-existing + maturin publish --skip-existing --zig else if [ -f "pyproject.toml" ]; then echo "Publishing $dir using Poetry..." @@ -156,7 +156,7 @@ jobs: echo "Package '$package_name' version '$version' already exists on crates.io. Skipping publish." else echo "Publishing package '$package_name' version '$version'..." - cargo publish + cargo publish fi fi fi diff --git a/node-hub/dora-internvl/dora_internvl/main.py b/node-hub/dora-internvl/dora_internvl/main.py index 5a0126367..d04339c51 100644 --- a/node-hub/dora-internvl/dora_internvl/main.py +++ b/node-hub/dora-internvl/dora_internvl/main.py @@ -101,6 +101,7 @@ def load_image(image_array: np.array, input_size=448, max_num=12): def main(): # Handle dynamic nodes, ask for the name of the node in the dataflow, and the same values as the ENV variables. model_path = os.getenv("MODEL", "OpenGVLab/InternVL2-1B") + device = "cuda:0" if torch.cuda.is_available() else "cpu" # If you want to load a model using multiple GPUs, please refer to the `Multiple GPUs` section. model = ( @@ -112,7 +113,7 @@ def main(): trust_remote_code=True, ) .eval() - .cuda() + .to(device) ) tokenizer = AutoTokenizer.from_pretrained( model_path, trust_remote_code=True, use_fast=False diff --git a/node-hub/dora-qwenvl/dora_qwenvl/main.py b/node-hub/dora-qwenvl/dora_qwenvl/main.py index 5dbec5cfb..31f11502c 100644 --- a/node-hub/dora-qwenvl/dora_qwenvl/main.py +++ b/node-hub/dora-qwenvl/dora_qwenvl/main.py @@ -1,5 +1,6 @@ import os from dora import Node +import torch from transformers import Qwen2VLForConditionalGeneration, AutoProcessor from qwen_vl_utils import process_vision_info import numpy as np @@ -83,7 +84,9 @@ def generate(frames: dict, question): padding=True, return_tensors="pt", ) - inputs = inputs.to("cuda") + + device = "cuda:0" if torch.cuda.is_available() else "cpu" + inputs = inputs.to(device) # Inference: Generation of the output generated_ids = model.generate(**inputs, max_new_tokens=128) diff --git a/node-hub/dora-qwenvl/pyproject.toml b/node-hub/dora-qwenvl/pyproject.toml index 060562eea..407887929 100644 --- a/node-hub/dora-qwenvl/pyproject.toml +++ b/node-hub/dora-qwenvl/pyproject.toml @@ -14,7 +14,7 @@ packages = [{ include = "dora_qwenvl" }] python = "^3.7" dora-rs = "^0.3.6" numpy = "< 2.0.0" -torch = "^2.4.0" +torch = "^2.2.0" torchvision = "^0.19" transformers = "^4.45" qwen-vl-utils = "^0.0.2"