Instructions to use hf-internal-testing/pixtral-12b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hf-internal-testing/pixtral-12b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="hf-internal-testing/pixtral-12b")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("hf-internal-testing/pixtral-12b") model = AutoModelForMultimodalLM.from_pretrained("hf-internal-testing/pixtral-12b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hf-internal-testing/pixtral-12b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hf-internal-testing/pixtral-12b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hf-internal-testing/pixtral-12b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hf-internal-testing/pixtral-12b
- SGLang
How to use hf-internal-testing/pixtral-12b 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 "hf-internal-testing/pixtral-12b" \ --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": "hf-internal-testing/pixtral-12b", "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 "hf-internal-testing/pixtral-12b" \ --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": "hf-internal-testing/pixtral-12b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hf-internal-testing/pixtral-12b with Docker Model Runner:
docker model run hf.co/hf-internal-testing/pixtral-12b
Commit History
-
config_updateβ
Verified signatureweights shape mismatch Script: ``` from transformers import LlavaForConditionalGeneration, AutoProcessor from PIL import Image model_id = "hf-internal-testing/pixtral-12b" model = LlavaForConditionalGeneration.from_pretrained(model_id) processor = AutoProcessor.from_pretrained(model_id) IMG_URLS = [ "https://picsum.photos/id/237/400/300", "https://picsum.photos/id/231/200/300", "https://picsum.photos/id/27/500/500", "https://picsum.photos/id/17/150/600", ] PROMPT = "<s>[INST]Describe the images.\n[IMG][IMG][IMG][IMG][/INST]" inputs = processor(images=IMG_URLS, text=PROMPT, return_tensors="pt") generate_ids = model.generate(**inputs, max_new_tokens=500) ouptut = processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0] ``` Error: ``` Loading checkpoint shards: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 6/6 [00:30<00:00, 5.16s/it] Traceback (most recent call last): File "/Users/varb/exo/teβ¦9a450cb
-
hidden_activation -> hidden_actβ
Verified signatureThis is the config value name for the copied MLP layerf9cc239 -
Upload processor
Verified signaturefb98a1a -
Upload LlavaForConditionalGeneration
Verified signature7e41c2a -
initial commit
Verified signatureed442dd