Image-Text-to-Text
Transformers
Safetensors
qwen3_5
phai-ide
science
code
tool-use
sft
lora
conversational
Instructions to use AItonomy/PhAI-IDE-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AItonomy/PhAI-IDE-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="AItonomy/PhAI-IDE-4B") 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, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("AItonomy/PhAI-IDE-4B") model = AutoModelForMultimodalLM.from_pretrained("AItonomy/PhAI-IDE-4B", device_map="auto") 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 Settings
- vLLM
How to use AItonomy/PhAI-IDE-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AItonomy/PhAI-IDE-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AItonomy/PhAI-IDE-4B", "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/AItonomy/PhAI-IDE-4B
- SGLang
How to use AItonomy/PhAI-IDE-4B 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 "AItonomy/PhAI-IDE-4B" \ --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": "AItonomy/PhAI-IDE-4B", "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 "AItonomy/PhAI-IDE-4B" \ --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": "AItonomy/PhAI-IDE-4B", "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 AItonomy/PhAI-IDE-4B with Docker Model Runner:
docker model run hf.co/AItonomy/PhAI-IDE-4B
Update README with verified ScienceAccelBench results
#1
by leyili6666 - opened
README.md
CHANGED
|
@@ -25,15 +25,15 @@ The training data is sourced from [AItonomy/ScienceIDE](https://huggingface.co/d
|
|
| 25 |
|
| 26 |
## Quick start
|
| 27 |
|
| 28 |
-
Use Transformers 5.16.1, PyTorch and Accelerate. The example loads the model, configuration and tokenizer directly from this repository.
|
| 29 |
|
| 30 |
```python
|
| 31 |
from transformers import AutoTokenizer, AutoModelForImageTextToText
|
| 32 |
|
| 33 |
model_id = "AItonomy/PhAI-IDE-4B"
|
| 34 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id
|
| 35 |
model = AutoModelForImageTextToText.from_pretrained(
|
| 36 |
-
model_id, dtype="bfloat16", device_map="auto",
|
| 37 |
)
|
| 38 |
inputs = tokenizer.apply_chat_template(
|
| 39 |
[{"role": "user", "content": "Explain how to verify a numerical simulation."}],
|
|
@@ -45,31 +45,13 @@ print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_to
|
|
| 45 |
|
| 46 |
BF16 weights occupy approximately 9.08 GB, plus runtime memory and KV cache.
|
| 47 |
|
| 48 |
-
##
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
| 55 |
-
| --- | ---: | ---: | ---: |
|
| 56 |
-
| BBH multistep-arithmetic-two | 92.40 | **97.60** | **+5.20** |
|
| 57 |
-
| HumanEvalFix-JS (docs-style repair) | 35.98 | **44.51** | **+8.54** |
|
| 58 |
-
| APPS introductory | 15.40 | **17.20** | **+1.80** |
|
| 59 |
-
| CRUXEval output prediction (128-sample subset) | 32.03 | **34.38** | **+2.34** |
|
| 60 |
-
|
| 61 |
-
### Comparison with published models
|
| 62 |
-
|
| 63 |
-
Scores (%); evaluation settings vary by source.
|
| 64 |
-
|
| 65 |
-
| Benchmark | Reference model | Parameters | Published score | PhAI-IDE-4B result | Source |
|
| 66 |
-
| --- | --- | ---: | ---: | ---: | --- |
|
| 67 |
-
| GSM8K | Llama-3.2-3B-Instruct | 3B | 77.7 | **89.06** | [Meta model card](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct#instruction-tuned-models) |
|
| 68 |
-
| GSM8K | Phi-3-mini | 3.8B | 82.5 | **89.06** | [Phi-3 report, §3](https://arxiv.org/html/2404.14219v1) |
|
| 69 |
-
| GSM8K | Qwen2.5-3B-Instruct | 3B | 86.7 | **89.06** | [Qwen2.5 report, Table 9](https://arxiv.org/html/2412.15115v2#S5.SS2.SSS1) |
|
| 70 |
-
| GSM8K | WizardMath-Llama-RL (Llama 3.2) | 3B | 85.5 | **89.06** | [WizardMath report, Tables 1 & 15](https://arxiv.org/html/2308.09583v2) |
|
| 71 |
-
| BBH multistep-arithmetic-two | Llama-3.2-3B-Instruct | 3.21B | 53.2 | **97.60** | [BenchLM independent results](https://huggingface.co/spaces/steampunque/benchlm/blob/d45e8600172857935610426f797a4429f2f136d6/README.md) |
|
| 72 |
-
| BBH multistep-arithmetic-two | Phi-3.5-mini-8k-instruct | 3.82B | 95.6 | **97.60** | [BenchLM independent results](https://huggingface.co/spaces/steampunque/benchlm/blob/d45e8600172857935610426f797a4429f2f136d6/README.md) |
|
| 73 |
|
| 74 |
## Training procedure
|
| 75 |
|
|
@@ -81,7 +63,7 @@ Fine-tuning uses text trajectories with the vision tower and aligner frozen. The
|
|
| 81 |
|
| 82 |
| Setting | Value |
|
| 83 |
| --- | --- |
|
| 84 |
-
| Training
|
| 85 |
| Training examples / tasks | 4,567 segments / 564 tasks |
|
| 86 |
| Validation examples / tasks | 544 segments / 81 tasks |
|
| 87 |
| Train/validation task overlap | 0 |
|
|
|
|
| 25 |
|
| 26 |
## Quick start
|
| 27 |
|
| 28 |
+
Use Transformers 5.16.1, PyTorch and Accelerate. The example loads the model, configuration and tokenizer directly from this repository.
|
| 29 |
|
| 30 |
```python
|
| 31 |
from transformers import AutoTokenizer, AutoModelForImageTextToText
|
| 32 |
|
| 33 |
model_id = "AItonomy/PhAI-IDE-4B"
|
| 34 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 35 |
model = AutoModelForImageTextToText.from_pretrained(
|
| 36 |
+
model_id, dtype="bfloat16", device_map="auto",
|
| 37 |
)
|
| 38 |
inputs = tokenizer.apply_chat_template(
|
| 39 |
[{"role": "user", "content": "Explain how to verify a numerical simulation."}],
|
|
|
|
| 45 |
|
| 46 |
BF16 weights occupy approximately 9.08 GB, plus runtime memory and KV cache.
|
| 47 |
|
| 48 |
+
## ScienceAccelBench performance
|
| 49 |
|
| 50 |
+
Task-held-out, localized scientific-code repair on familiar codebases, with original numerical verification. Pass rates (%); gains in percentage points.
|
| 51 |
|
| 52 |
+
| Environment | Tasks | Qwen3.5-4B | PhAI-IDE-4B | Gain (pp) |
|
| 53 |
+
| --- | ---: | ---: | ---: | ---: |
|
| 54 |
+
| pluto-particles-dust | 3 | 0.00 | **33.33** | **+33.33** |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
## Training procedure
|
| 57 |
|
|
|
|
| 63 |
|
| 64 |
| Setting | Value |
|
| 65 |
| --- | --- |
|
| 66 |
+
| Training dataset | Codex trajectories |
|
| 67 |
| Training examples / tasks | 4,567 segments / 564 tasks |
|
| 68 |
| Validation examples / tasks | 544 segments / 81 tasks |
|
| 69 |
| Train/validation task overlap | 0 |
|