Instructions to use Mihaiii/Ovis2-4B-RL-VQA-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mihaiii/Ovis2-4B-RL-VQA-1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mihaiii/Ovis2-4B-RL-VQA-1", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Mihaiii/Ovis2-4B-RL-VQA-1", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Mihaiii/Ovis2-4B-RL-VQA-1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mihaiii/Ovis2-4B-RL-VQA-1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mihaiii/Ovis2-4B-RL-VQA-1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Mihaiii/Ovis2-4B-RL-VQA-1
- SGLang
How to use Mihaiii/Ovis2-4B-RL-VQA-1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Mihaiii/Ovis2-4B-RL-VQA-1" \ --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": "Mihaiii/Ovis2-4B-RL-VQA-1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "Mihaiii/Ovis2-4B-RL-VQA-1" \ --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": "Mihaiii/Ovis2-4B-RL-VQA-1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Mihaiii/Ovis2-4B-RL-VQA-1 with Docker Model Runner:
docker model run hf.co/Mihaiii/Ovis2-4B-RL-VQA-1
%%bash
CUDA_VISIBLE_DEVICES=0
MAX_PIXELS=1003520
swift rlhf
--rlhf_type grpo
--model 'Mihaiii/Ovis2-4B'
--model_type ovis2
--external_plugins './plugin.py'
--reward_funcs external_db_accuracy
--train_type lora
--lora_rank 8
--lora_alpha 32
--target_modules all-linear
--torch_dtype bfloat16
--dataset 'Mihaiii/OCRBenchv2-other-cols-2'
--use_hf 1
--max_completion_length 1024
--num_train_epochs 1
--per_device_train_batch_size 4
--per_device_eval_batch_size 4
--learning_rate 1e-4
--gradient_accumulation_steps 1
--eval_steps 50
--save_steps 250
--save_total_limit 2
--logging_steps 5
--max_length 2048
--output_dir output
--warmup_ratio 0.05
--dataloader_num_workers 4
--dataset_num_proc 4
--num_generations 4
--temperature 0.9
--split_dataset_ratio 0
- Downloads last month
- 4