Image-Text-to-Text
Transformers
Safetensors
English
qwen2_5_vl
multimodal
image caption
captioning
conversational
text-generation-inference
Instructions to use internlm/CapRL-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/CapRL-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="internlm/CapRL-3B") 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("internlm/CapRL-3B") model = AutoModelForMultimodalLM.from_pretrained("internlm/CapRL-3B", 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 internlm/CapRL-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/CapRL-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/CapRL-3B", "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/internlm/CapRL-3B
- SGLang
How to use internlm/CapRL-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 "internlm/CapRL-3B" \ --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": "internlm/CapRL-3B", "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 "internlm/CapRL-3B" \ --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": "internlm/CapRL-3B", "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 internlm/CapRL-3B with Docker Model Runner:
docker model run hf.co/internlm/CapRL-3B
Commit History
-
Update README.md
Verified signaturef83373e -
Update README.md
Verified signature7cd66b5 -
Update README.md
Verified signature917a2f6
-
Update README.md
Verified signature4c95f43
-
Update README.md
Verified signatureb6820cd
-
Update README.md
Verified signature6f5ab85
-
Update README.md
Verified signature918d590 -
Update README.md
Verified signature8a2e07e
-
Update README.md
Verified signatureec60e9f -
Update README.md
Verified signaturea1ada44 -
Update README.md
Verified signaturea606d46 -
Update README.md
Verified signature7552cbe -
Update README.md
Verified signaturebe6e330 -
Update README.md
Verified signature30c515b -
Update README.md
Verified signature72e3579 -
Upload performance_update.png
Verified signatureeeb96d4 -
Update README.md
Verified signature3e779b5
-
Update README.md
Verified signatured2089c3
-
Add link to GitHub code repository (#1)
Verified signature- Add link to GitHub code repository (5f835bb619c42b339fbce36f9f2c4042d5c16adf) Co-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>92a8d4d
-
Update README.md
Verified signature76d8fb2
-
Update README.md
Verified signaturea38a4ba
-
Update README.md
Verified signature47ea6cf -
Update README.md
Verified signatured94df61 -
Add files using upload-large-folder tool
Verified signatureff71da6 -
Update README.md
Verified signature6d287df
-
Delete case3.pdf
Verified signature23c8441 -
Delete case2.pdf
Verified signature085cefd -
Delete case1.pdf
Verified signature3a0cbcb -
Update README.md
Verified signature8dae112 -
Update README.md
Verified signatured2b5e1c -
Update README.md
Verified signatureb42cb54 -
Rename longcase1.pdf to case2.pdf
Verified signature1f916d4 -
Rename enhance_clarity_case.pdf to case1.pdf
Verified signature8e24ad8 -
Rename caprl_trump.pdf to case3.pdf
Verified signatured368536 -
Upload 3 files
Verified signatured9f80b9 -
Update README.md
Verified signaturefdee6ca -
Update README.md
Verified signaturecdaad41 -
Add files using upload-large-folder tool
Verified signaturee25de6e
-
Update README.md
Verified signatureafbf8a4 -
Update README.md
Verified signatureaf935d2 -
Update README.md
Verified signature37dfcd9 -
initial commit
Verified signature28a3057