Image-Text-to-Text
Transformers
Safetensors
qwen3_5
clef
cloudflare
systemone
decision-model
qwen3.5
post-train
image-text-to-typed-output
multimodal
structured-output
classification
custom-code
conversational
Eval Results
Instructions to use Cloudflare/clef-flash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Cloudflare/clef-flash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Cloudflare/clef-flash") 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("Cloudflare/clef-flash") model = AutoModelForMultimodalLM.from_pretrained("Cloudflare/clef-flash", 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 Cloudflare/clef-flash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Cloudflare/clef-flash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Cloudflare/clef-flash", "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/Cloudflare/clef-flash
- SGLang
How to use Cloudflare/clef-flash 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 "Cloudflare/clef-flash" \ --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": "Cloudflare/clef-flash", "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 "Cloudflare/clef-flash" \ --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": "Cloudflare/clef-flash", "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 Cloudflare/clef-flash with Docker Model Runner:
docker model run hf.co/Cloudflare/clef-flash
Add SGLang cookbook and launch command to model card
Browse files
README.md
CHANGED
|
@@ -91,6 +91,32 @@ for question, question_logits in zip(encoded.questions, logits):
|
|
| 91 |
print(question.question_id, dict(zip(question.option_ids, probabilities)))
|
| 92 |
```
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
### Jev / SystemOne API
|
| 95 |
|
| 96 |
`systemone` takes a Jev/SystemOne `POST /v1/systemone` request body and returns the same response
|
|
|
|
| 91 |
print(question.question_id, dict(zip(question.option_ids, probabilities)))
|
| 92 |
```
|
| 93 |
|
| 94 |
+
### SGLang
|
| 95 |
+
|
| 96 |
+
Clef-Flash can be served with SGLang. See the [SGLang cookbook](https://docs.sglang.io/cookbook/autoregressive/Cloudflare/clef#hw=h200&variant=flash&quant=bf16&strategy=balanced&nodes=single) for
|
| 97 |
+
launch commands on H200, B200, and B300. On a single H200:
|
| 98 |
+
|
| 99 |
+
```bash
|
| 100 |
+
docker run --gpus all \
|
| 101 |
+
--shm-size 32g \
|
| 102 |
+
-p 30000:30000 \
|
| 103 |
+
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
| 104 |
+
--ipc=host \
|
| 105 |
+
lmsysorg/sglang:dev-clef \
|
| 106 |
+
sglang serve \
|
| 107 |
+
--model-path Cloudflare/clef-flash \
|
| 108 |
+
--host 0.0.0.0 \
|
| 109 |
+
--port 30000
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
The server answers Jev/SystemOne requests at `/v1/systemone`:
|
| 113 |
+
|
| 114 |
+
```bash
|
| 115 |
+
curl http://localhost:30000/v1/systemone \
|
| 116 |
+
-H 'Content-Type: application/json' \
|
| 117 |
+
-d '{"model":"Cloudflare/clef-flash","state":"My Stripe integration keeps failing. Please help ASAP.","questions":{"urgency":{"type":"noul","instructions":"Does this message express urgency?"}}}'
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
### Jev / SystemOne API
|
| 121 |
|
| 122 |
`systemone` takes a Jev/SystemOne `POST /v1/systemone` request body and returns the same response
|