Instructions to use Hon-Wong/VoRA-7B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Hon-Wong/VoRA-7B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Hon-Wong/VoRA-7B-Instruct", trust_remote_code=True) 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 AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Hon-Wong/VoRA-7B-Instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Hon-Wong/VoRA-7B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Hon-Wong/VoRA-7B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Hon-Wong/VoRA-7B-Instruct", "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/Hon-Wong/VoRA-7B-Instruct
- SGLang
How to use Hon-Wong/VoRA-7B-Instruct 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 "Hon-Wong/VoRA-7B-Instruct" \ --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": "Hon-Wong/VoRA-7B-Instruct", "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 "Hon-Wong/VoRA-7B-Instruct" \ --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": "Hon-Wong/VoRA-7B-Instruct", "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 Hon-Wong/VoRA-7B-Instruct with Docker Model Runner:
docker model run hf.co/Hon-Wong/VoRA-7B-Instruct
Improve model card
#1
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,37 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# VoRA
|
| 2 |
* [ArXiv Paper](https://arxiv.org/abs/2503.20680)
|
| 3 |
* [Github](https://github.com/Hon-Wong/VoRA)
|
| 4 |
|
| 5 |
## Quickstart
|
| 6 |
|
|
|
|
|
|
|
| 7 |
```python
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
pipeline_tag: image-text-to-text
|
| 4 |
+
base_model:
|
| 5 |
+
- Hon-Wong/VoRA-7B-Base
|
| 6 |
+
datasets:
|
| 7 |
+
- Hon-Wong/VoRA-Recap-29M
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
# VoRA
|
| 11 |
* [ArXiv Paper](https://arxiv.org/abs/2503.20680)
|
| 12 |
* [Github](https://github.com/Hon-Wong/VoRA)
|
| 13 |
|
| 14 |
## Quickstart
|
| 15 |
|
| 16 |
+
The model can be used as follows:
|
| 17 |
+
|
| 18 |
```python
|
| 19 |
+
import torch
|
| 20 |
+
from transformers import AutoProcessor, AutoModelForCausalLM
|
| 21 |
+
model_name = "Hon-Wong/VoRA-7B-Instruct"
|
| 22 |
+
processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
|
| 23 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
|
| 24 |
+
conversation = [
|
| 25 |
+
{
|
| 26 |
+
"role":"user",
|
| 27 |
+
"content":[
|
| 28 |
+
{
|
| 29 |
+
"type":"image",
|
| 30 |
+
"url": "{image path or url}"
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"type":"text",
|
| 34 |
+
"text":"<image> Describe this image."
|
| 35 |
+
}
|
| 36 |
+
]
|
| 37 |
+
}
|
| 38 |
+
]
|
| 39 |
+
model_inputs = processor.apply_chat_template(conversation, add_generation_prompt=True, tokenize=True, return_tensors='pt', return_dict=True).to(model.device)
|
| 40 |
+
gen_kwargs = {"max_new_tokens": 1024, "eos_token_id": processor.tokenizer.eos_token_id}
|
| 41 |
+
|
| 42 |
+
with torch.inference_mode():
|
| 43 |
+
outputs = model.generate(model_inputs, **gen_kwargs)
|
| 44 |
+
output_text = processor.tokenizer.batch_decode(
|
| 45 |
+
outputs, skip_special_tokens=True
|
| 46 |
+
)
|
| 47 |
+
print(output_text)
|
| 48 |
```
|