Image-Text-to-Text
Transformers
Safetensors
qwen2_5_vl
llama-factory
full
Generated from Trainer
conversational
text-generation-inference
Instructions to use ydeng9/OpenVLThinker-7B-v1.2-sft-iter3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ydeng9/OpenVLThinker-7B-v1.2-sft-iter3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ydeng9/OpenVLThinker-7B-v1.2-sft-iter3") 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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("ydeng9/OpenVLThinker-7B-v1.2-sft-iter3") model = AutoModelForImageTextToText.from_pretrained("ydeng9/OpenVLThinker-7B-v1.2-sft-iter3") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ydeng9/OpenVLThinker-7B-v1.2-sft-iter3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ydeng9/OpenVLThinker-7B-v1.2-sft-iter3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ydeng9/OpenVLThinker-7B-v1.2-sft-iter3", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/ydeng9/OpenVLThinker-7B-v1.2-sft-iter3
- SGLang
How to use ydeng9/OpenVLThinker-7B-v1.2-sft-iter3 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 "ydeng9/OpenVLThinker-7B-v1.2-sft-iter3" \ --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": "ydeng9/OpenVLThinker-7B-v1.2-sft-iter3", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "ydeng9/OpenVLThinker-7B-v1.2-sft-iter3" \ --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": "ydeng9/OpenVLThinker-7B-v1.2-sft-iter3", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use ydeng9/OpenVLThinker-7B-v1.2-sft-iter3 with Docker Model Runner:
docker model run hf.co/ydeng9/OpenVLThinker-7B-v1.2-sft-iter3
| { | |
| "best_metric": null, | |
| "best_model_checkpoint": null, | |
| "epoch": 0.9902912621359223, | |
| "eval_steps": 500, | |
| "global_step": 51, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "epoch": 0.1941747572815534, | |
| "grad_norm": 4.664066413285674, | |
| "learning_rate": 4.973358420187776e-06, | |
| "loss": 0.7795, | |
| "step": 10 | |
| }, | |
| { | |
| "epoch": 0.3883495145631068, | |
| "grad_norm": 1.9822347336414026, | |
| "learning_rate": 4.099182553897228e-06, | |
| "loss": 0.2484, | |
| "step": 20 | |
| }, | |
| { | |
| "epoch": 0.5825242718446602, | |
| "grad_norm": 1.5984451911406743, | |
| "learning_rate": 2.408694942355853e-06, | |
| "loss": 0.1545, | |
| "step": 30 | |
| }, | |
| { | |
| "epoch": 0.7766990291262136, | |
| "grad_norm": 1.4874861508376533, | |
| "learning_rate": 7.648145119484152e-07, | |
| "loss": 0.1388, | |
| "step": 40 | |
| }, | |
| { | |
| "epoch": 0.970873786407767, | |
| "grad_norm": 1.3943333378740448, | |
| "learning_rate": 6.66929084112089e-09, | |
| "loss": 0.1317, | |
| "step": 50 | |
| }, | |
| { | |
| "epoch": 0.9902912621359223, | |
| "step": 51, | |
| "total_flos": 9087886688256.0, | |
| "train_loss": 0.2873636951633528, | |
| "train_runtime": 208.0579, | |
| "train_samples_per_second": 15.784, | |
| "train_steps_per_second": 0.245 | |
| } | |
| ], | |
| "logging_steps": 10, | |
| "max_steps": 51, | |
| "num_input_tokens_seen": 0, | |
| "num_train_epochs": 1, | |
| "save_steps": 1000, | |
| "stateful_callbacks": { | |
| "TrainerControl": { | |
| "args": { | |
| "should_epoch_stop": false, | |
| "should_evaluate": false, | |
| "should_log": false, | |
| "should_save": true, | |
| "should_training_stop": true | |
| }, | |
| "attributes": {} | |
| } | |
| }, | |
| "total_flos": 9087886688256.0, | |
| "train_batch_size": 2, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |