Instructions to use FreedomIntelligence/ALLaVA-Phi2-2_7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FreedomIntelligence/ALLaVA-Phi2-2_7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FreedomIntelligence/ALLaVA-Phi2-2_7B", trust_remote_code=True, device_map="auto")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("FreedomIntelligence/ALLaVA-Phi2-2_7B", trust_remote_code=True, dtype="auto", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use FreedomIntelligence/ALLaVA-Phi2-2_7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FreedomIntelligence/ALLaVA-Phi2-2_7B" # 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-Phi2-2_7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/FreedomIntelligence/ALLaVA-Phi2-2_7B
- SGLang
How to use FreedomIntelligence/ALLaVA-Phi2-2_7B 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-Phi2-2_7B" \ --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-Phi2-2_7B", "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-Phi2-2_7B" \ --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-Phi2-2_7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use FreedomIntelligence/ALLaVA-Phi2-2_7B with Docker Model Runner:
docker model run hf.co/FreedomIntelligence/ALLaVA-Phi2-2_7B
Update README.md
Browse files
README.md
CHANGED
|
@@ -78,22 +78,24 @@ achieve competitive results on 17 benchmarks.
|
|
| 78 |
|
| 79 |
## 🏭 Inference
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
| 83 |
|
| 84 |
-
### CLI
|
| 85 |
-
See [here](https://github.com/FreedomIntelligence/ALLaVA/tree/main?tab=readme-ov-file#cli) for CLI code snippet.
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
## 🏋️♂️ Training
|
| 90 |
|
| 91 |
### Data
|
| 92 |
-
<
|
| 93 |
<img src="training_datasets_by_stage.jpg" width = "640" alt="training_datasets" align=center />
|
| 94 |
-
</div>
|
| 95 |
|
| 96 |
-
ALLaVA uses
|
| 97 |
|
| 98 |
|
| 99 |
### Code
|
|
@@ -110,7 +112,7 @@ These two models share the same PT procedure. -->
|
|
| 110 |
### Hyperparameters
|
| 111 |
|
| 112 |
| Global Batch Size| ZeRO Stage| Optimizer | Max LR| Min LR | Scheduler | Weight decay |
|
| 113 |
-
| ---: | ---: |--:| ---: | ---: | ---: | ---: |
|
| 114 |
| 256 (PT) / 128 (FT) | 1| AdamW | 2e-5 | 2e-6 | CosineAnnealingWarmRestarts | 0 |
|
| 115 |
|
| 116 |
The LM backbone, projector are trainable, while the vision encoder is kept frozen.
|
|
|
|
| 78 |
|
| 79 |
## 🏭 Inference
|
| 80 |
|
| 81 |
+
All models can be loaded from 🤗 with `.from_pretrained()`.
|
| 82 |
+
Check out the [example scripts](https://github.com/FreedomIntelligence/ALLaVA/tree/main/allava/serve) and make sure you have the same outputs as shown in the scripts.
|
| 83 |
+
<!-- ### Load from 🤗 (Recommended)
|
| 84 |
+
See the [example script](https://github.com/FreedomIntelligence/ALLaVA/blob/main/allava/serve/huggingface_inference.py). -->
|
| 85 |
|
| 86 |
+
<!-- ### CLI
|
| 87 |
+
See [here](https://github.com/FreedomIntelligence/ALLaVA/tree/main?tab=readme-ov-file#cli) for CLI code snippet. -->
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
## 🏋️♂️ Training
|
| 92 |
|
| 93 |
### Data
|
| 94 |
+
<div align=center>
|
| 95 |
<img src="training_datasets_by_stage.jpg" width = "640" alt="training_datasets" align=center />
|
| 96 |
+
</div>
|
| 97 |
|
| 98 |
+
ALLaVA uses 1.0M and 1.5M data for PT. and FT., respectively.
|
| 99 |
|
| 100 |
|
| 101 |
### Code
|
|
|
|
| 112 |
### Hyperparameters
|
| 113 |
|
| 114 |
| Global Batch Size| ZeRO Stage| Optimizer | Max LR| Min LR | Scheduler | Weight decay |
|
| 115 |
+
| ---: | ---: |--:| ---: | ---: | ---: | ---: |
|
| 116 |
| 256 (PT) / 128 (FT) | 1| AdamW | 2e-5 | 2e-6 | CosineAnnealingWarmRestarts | 0 |
|
| 117 |
|
| 118 |
The LM backbone, projector are trainable, while the vision encoder is kept frozen.
|