Instructions to use FreedomIntelligence/ALLaVA-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FreedomIntelligence/ALLaVA-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FreedomIntelligence/ALLaVA-3B", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("FreedomIntelligence/ALLaVA-3B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use FreedomIntelligence/ALLaVA-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FreedomIntelligence/ALLaVA-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FreedomIntelligence/ALLaVA-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/FreedomIntelligence/ALLaVA-3B
- SGLang
How to use FreedomIntelligence/ALLaVA-3B 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 "FreedomIntelligence/ALLaVA-3B" \ --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": "FreedomIntelligence/ALLaVA-3B", "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 "FreedomIntelligence/ALLaVA-3B" \ --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": "FreedomIntelligence/ALLaVA-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use FreedomIntelligence/ALLaVA-3B with Docker Model Runner:
docker model run hf.co/FreedomIntelligence/ALLaVA-3B
Update README.md
Browse files
README.md
CHANGED
|
@@ -29,6 +29,9 @@ gen_kwargs = {
|
|
| 29 |
'eos_token_id': tokenizer.eos_token_id # this is a must since transformers ~4.37
|
| 30 |
}
|
| 31 |
|
|
|
|
|
|
|
|
|
|
| 32 |
response, history = model.chat(
|
| 33 |
texts='What is in the image?',
|
| 34 |
images=['https://cdn-icons-png.flaticon.com/256/6028/6028690.png'],
|
|
@@ -36,14 +39,19 @@ response, history = model.chat(
|
|
| 36 |
**gen_kwargs
|
| 37 |
)
|
| 38 |
|
|
|
|
| 39 |
print(response)
|
|
|
|
|
|
|
| 40 |
# response:
|
| 41 |
# The image contains a large, stylized "HI!" in a bright pink color with yellow outlines. The "HI!" is placed within a speech bubble shape.
|
| 42 |
|
| 43 |
# history:
|
| 44 |
# [['What is in the image?', 'The image contains a large, stylized "HI!" in a bright pink color with yellow outlines. The "HI!" is placed within a speech bubble shape.']]
|
| 45 |
|
| 46 |
-
|
|
|
|
|
|
|
| 47 |
response, history = model.chat(
|
| 48 |
texts='Are you sure?',
|
| 49 |
images=['https://cdn-icons-png.flaticon.com/256/6028/6028690.png'], # images need to be passed again in multi-round conversations
|
|
@@ -52,7 +60,10 @@ response, history = model.chat(
|
|
| 52 |
**gen_kwargs
|
| 53 |
)
|
| 54 |
|
|
|
|
| 55 |
print(response)
|
|
|
|
|
|
|
| 56 |
# response:
|
| 57 |
# Yes, I'm certain. The image is a graphic representation of the word "HI!" in a speech bubble.
|
| 58 |
|
|
|
|
| 29 |
'eos_token_id': tokenizer.eos_token_id # this is a must since transformers ~4.37
|
| 30 |
}
|
| 31 |
|
| 32 |
+
#################################################################################
|
| 33 |
+
# first round
|
| 34 |
+
#################################################################################
|
| 35 |
response, history = model.chat(
|
| 36 |
texts='What is in the image?',
|
| 37 |
images=['https://cdn-icons-png.flaticon.com/256/6028/6028690.png'],
|
|
|
|
| 39 |
**gen_kwargs
|
| 40 |
)
|
| 41 |
|
| 42 |
+
print('response:')
|
| 43 |
print(response)
|
| 44 |
+
print('history:')
|
| 45 |
+
print(history)
|
| 46 |
# response:
|
| 47 |
# The image contains a large, stylized "HI!" in a bright pink color with yellow outlines. The "HI!" is placed within a speech bubble shape.
|
| 48 |
|
| 49 |
# history:
|
| 50 |
# [['What is in the image?', 'The image contains a large, stylized "HI!" in a bright pink color with yellow outlines. The "HI!" is placed within a speech bubble shape.']]
|
| 51 |
|
| 52 |
+
#################################################################################
|
| 53 |
+
# second round
|
| 54 |
+
#################################################################################
|
| 55 |
response, history = model.chat(
|
| 56 |
texts='Are you sure?',
|
| 57 |
images=['https://cdn-icons-png.flaticon.com/256/6028/6028690.png'], # images need to be passed again in multi-round conversations
|
|
|
|
| 60 |
**gen_kwargs
|
| 61 |
)
|
| 62 |
|
| 63 |
+
print('response:')
|
| 64 |
print(response)
|
| 65 |
+
print('history:')
|
| 66 |
+
print(history)
|
| 67 |
# response:
|
| 68 |
# Yes, I'm certain. The image is a graphic representation of the word "HI!" in a speech bubble.
|
| 69 |
|