Legad/scangas-images
Viewer • Updated • 146 • 9
How to use Legad/qwen25-vl-scangas with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct")
model = PeftModel.from_pretrained(base_model, "Legad/qwen25-vl-scangas")How to use Legad/qwen25-vl-scangas with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Legad/qwen25-vl-scangas")
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
{"type": "text", "text": "What animal is on the candy?"}
]
},
]
pipe(text=messages) # Load model directly
from transformers import AutoProcessor, AutoModelForMultimodalLM
processor = AutoProcessor.from_pretrained("Legad/qwen25-vl-scangas")
model = AutoModelForMultimodalLM.from_pretrained("Legad/qwen25-vl-scangas", device_map="auto")
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
{"type": "text", "text": "What animal is on the candy?"}
]
},
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use Legad/qwen25-vl-scangas with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Legad/qwen25-vl-scangas"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Legad/qwen25-vl-scangas",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Legad/qwen25-vl-scangas
How to use Legad/qwen25-vl-scangas with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Legad/qwen25-vl-scangas" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Legad/qwen25-vl-scangas",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "Legad/qwen25-vl-scangas" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Legad/qwen25-vl-scangas",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Legad/qwen25-vl-scangas with Docker Model Runner:
docker model run hf.co/Legad/qwen25-vl-scangas
axolotl version: 0.13.0.dev0
base_model: Qwen/Qwen2.5-VL-7B-Instruct
processor_type: AutoProcessor
trust_remote_code: true
load_in_8bit: false
load_in_4bit: true
bf16: true
fp16: false
adapter: lora
lora_r: 16
lora_alpha: 32
lora_dropout: 0.05
lora_target_modules:
- q_proj
- k_proj
- v_proj
- o_proj
- gate_proj
- up_proj
- down_proj
datasets:
- path: Legad/scangas-images
type: chat_template
field_messages: messages
field_images: images
remove_unused_columns: false
skip_prepare_dataset: true
sample_packing: false
sequence_len: 2048
micro_batch_size: 1
gradient_checkpointing: true
gradient_accumulation_steps: 4
num_epochs: 10
learning_rate: 2e-4
optimizer: adamw_bnb_8bit
lr_scheduler: cosine
output_dir: ./outputs/qwen25-vl-finetuned
save_safetensors: true
This model is a fine-tuned version of Qwen/Qwen2.5-VL-7B-Instruct on the Legad/scangas-images dataset.
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
Base model
Qwen/Qwen2.5-VL-7B-Instruct