Instructions to use OEvortex/HelpingAI-Vision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OEvortex/HelpingAI-Vision with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OEvortex/HelpingAI-Vision", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OEvortex/HelpingAI-Vision", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OEvortex/HelpingAI-Vision with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OEvortex/HelpingAI-Vision" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OEvortex/HelpingAI-Vision", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/OEvortex/HelpingAI-Vision
- SGLang
How to use OEvortex/HelpingAI-Vision 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 "OEvortex/HelpingAI-Vision" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OEvortex/HelpingAI-Vision", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "OEvortex/HelpingAI-Vision" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OEvortex/HelpingAI-Vision", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use OEvortex/HelpingAI-Vision with Docker Model Runner:
docker model run hf.co/OEvortex/HelpingAI-Vision
Update README.md
Browse files
README.md
CHANGED
|
@@ -109,17 +109,22 @@ Describe the image.<|im_end|>
|
|
| 109 |
**Process inputs**
|
| 110 |
|
| 111 |
```python
|
| 112 |
-
|
|
|
|
| 113 |
|
| 114 |
inputs['input_ids'] = inputs['input_ids'].to(model.device)
|
| 115 |
inputs['attention_mask'] = inputs['attention_mask'].to(model.device)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
```
|
| 117 |
|
| 118 |
**Generate the data**
|
| 119 |
|
| 120 |
```python
|
| 121 |
-
|
| 122 |
-
|
| 123 |
with torch.inference_mode():
|
| 124 |
-
output = model.generate(**inputs, max_new_tokens=200, do_sample=True,
|
|
|
|
| 125 |
```
|
|
|
|
| 109 |
**Process inputs**
|
| 110 |
|
| 111 |
```python
|
| 112 |
+
with torch.inference_mode():
|
| 113 |
+
inputs = processor(prompt, raw_image, model, return_tensors='pt')
|
| 114 |
|
| 115 |
inputs['input_ids'] = inputs['input_ids'].to(model.device)
|
| 116 |
inputs['attention_mask'] = inputs['attention_mask'].to(model.device)
|
| 117 |
+
|
| 118 |
+
from transformers import TextStreamer
|
| 119 |
+
|
| 120 |
+
streamer = TextStreamer(tokenizer)
|
| 121 |
```
|
| 122 |
|
| 123 |
**Generate the data**
|
| 124 |
|
| 125 |
```python
|
| 126 |
+
%%time
|
|
|
|
| 127 |
with torch.inference_mode():
|
| 128 |
+
output = model.generate(**inputs, max_new_tokens=200, do_sample=True, top_p=0.9, temperature=1.2, eos_token_id=tokenizer.eos_token_id, streamer=streamer)
|
| 129 |
+
print(tokenizer.decode(output[0]).replace(prompt, "").replace("<|im_end|>", ""))
|
| 130 |
```
|