Instructions to use PhaiModelLab/Phai-A1-35B-1M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PhaiModelLab/Phai-A1-35B-1M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="PhaiModelLab/Phai-A1-35B-1M") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("PhaiModelLab/Phai-A1-35B-1M") model = AutoModelForMultimodalLM.from_pretrained("PhaiModelLab/Phai-A1-35B-1M", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PhaiModelLab/Phai-A1-35B-1M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PhaiModelLab/Phai-A1-35B-1M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PhaiModelLab/Phai-A1-35B-1M", "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/PhaiModelLab/Phai-A1-35B-1M
- SGLang
How to use PhaiModelLab/Phai-A1-35B-1M 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 "PhaiModelLab/Phai-A1-35B-1M" \ --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": "PhaiModelLab/Phai-A1-35B-1M", "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 "PhaiModelLab/Phai-A1-35B-1M" \ --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": "PhaiModelLab/Phai-A1-35B-1M", "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 PhaiModelLab/Phai-A1-35B-1M with Docker Model Runner:
docker model run hf.co/PhaiModelLab/Phai-A1-35B-1M
Commit History
2 days ago
-
Update README.md
Verified signaturecd4471a
7 days ago
-
Update README_zh.md
Verified signaturee95b114 -
Update README.md
Verified signatured6010e8 -
Upload _benchmarks.png
Verified signature360c440 -
Delete _assets_/_benchmarks.png
Verified signature0c1a8e3 -
Update README.md
Verified signatured1f138c -
Create README_zh.md
Verified signatureedeeb3d -
Update README.md
Verified signature0bc41ff
9 days ago
-
Sync model-00016-of-00016.safetensors from ModelScope
Verified signature89a495a -
Sync model-00015-of-00016.safetensors from ModelScope
Verified signature4d839bb -
Sync model-00014-of-00016.safetensors from ModelScope
Verified signature2a89d7a -
Sync model-00013-of-00016.safetensors from ModelScope
Verified signatured5a9944 -
Sync model-00012-of-00016.safetensors from ModelScope
Verified signaturef5d0060 -
Sync model-00011-of-00016.safetensors from ModelScope
Verified signature4eb3afc -
Sync model-00010-of-00016.safetensors from ModelScope
Verified signature7edc657 -
Sync tokenizer_config.json from ModelScope
Verified signatureebd54a3 -
Sync tokenizer.json from ModelScope
Verified signaturef18f115 -
Sync processor_config.json from ModelScope
Verified signatureeabcdc2 -
Sync preprocessor_config.json from ModelScope
Verified signature35c914a -
Sync model.safetensors.index.json from ModelScope
Verified signature0a12ad5 -
Sync model-00009-of-00016.safetensors from ModelScope
Verified signature6a81c29 -
Sync model-00008-of-00016.safetensors from ModelScope
Verified signature8d3f601 -
Sync model-00007-of-00016.safetensors from ModelScope
Verified signaturee58220a -
Sync model-00006-of-00016.safetensors from ModelScope
Verified signature676758d -
Sync model-00005-of-00016.safetensors from ModelScope
Verified signature5dfe6b0 -
Sync model-00004-of-00016.safetensors from ModelScope
Verified signaturea8ecd4e -
Sync model-00003-of-00016.safetensors from ModelScope
Verified signature55cc437 -
Sync model-00002-of-00016.safetensors from ModelScope
Verified signaturec595b01 -
Sync model-00001-of-00016.safetensors from ModelScope
Verified signatureff015e2 -
Sync generation_config.json from ModelScope
Verified signature9b7a464 -
Sync config.json from ModelScope
Verified signature9a4a6ff -
Sync chat_template.jinja from ModelScope
Verified signatureba63300 -
Sync _assets_/_benchmarks.png from ModelScope
Verified signatureb83f761 -
Sync README.md from ModelScope
Verified signatured40122d -
initial commit
Verified signature5d417b1