Instructions to use thinkingmachines/TML-d24-varloop-research with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thinkingmachines/TML-d24-varloop-research with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="thinkingmachines/TML-d24-varloop-research") 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("thinkingmachines/TML-d24-varloop-research") model = AutoModelForMultimodalLM.from_pretrained("thinkingmachines/TML-d24-varloop-research", 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 thinkingmachines/TML-d24-varloop-research with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "thinkingmachines/TML-d24-varloop-research" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thinkingmachines/TML-d24-varloop-research", "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/thinkingmachines/TML-d24-varloop-research
- SGLang
How to use thinkingmachines/TML-d24-varloop-research 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 "thinkingmachines/TML-d24-varloop-research" \ --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": "thinkingmachines/TML-d24-varloop-research", "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 "thinkingmachines/TML-d24-varloop-research" \ --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": "thinkingmachines/TML-d24-varloop-research", "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 thinkingmachines/TML-d24-varloop-research with Docker Model Runner:
docker model run hf.co/thinkingmachines/TML-d24-varloop-research
CMF build for cortiq: one 15.1 GB file, 1 to 5 passes at run time, 129.5 tok/s on an RTX PRO 6000
The variable-looped model now runs in cortiq, a Rust inference engine with no Python and no ML framework. The CMF build is here: https://huggingface.co/infosave/TML-d24-varloop-research-cmf (one file, TML-d24-varloop-research-q4tp.cmf, 15.12 GB: the language model and the release's DSpark drafter, every weight on one 24 GB card; the vision tower is not in it).
The pass count is a run-time switch: --loops N runs the 12 middle layers N times; without it the file runs 3, as the model was post-trained.
| passes | WikiText-2 ppl | f32 reference | NVIDIA L4, tok/s | RTX PRO 6000, tok/s |
|---|---|---|---|---|
| 1 | 9.930 | 9.784 | 98.5 | 271.0 |
| 2 | 9.627 | — | 66.7 | 174.6 |
| 3 | 9.239 | 9.134 | 50.6 | 127.9 |
| 4 | 9.231 | — | 41.4 | 101.3 |
| 5 | 9.218 | 9.118 | 34.7 | 83.9 |
Decode on CUDA without speculative decoding; the reference runs the release's layers in f32 (transformers PR #51050 with the pass count set).
Fastest results, 3 passes:
- NVIDIA RTX PRO 6000 Blackwell, CUDA: 129.5 tok/s, a 2 048-token prompt in 0.26 s; with DSpark 232.1 tok/s on Python code and 249.2 on JSON.
- NVIDIA L4 (24 GB), CUDA: 50.9 tok/s, with DSpark 78.2 on code and 68.7 on JSON; a 32 768-token prompt in 32.0 s.
- The same L4 over Vulkan: 35.7 tok/s. MacBook Air M4 (24 GB): 25.1 tok/s through Metal, 10.8 on the CPU alone.
CUDA, Vulkan and Metal agree on perplexity: 9.239, 9.237 and 9.231.
cargo install cortiq-cli --features cuda
hf download infosave/TML-d24-varloop-research-cmf TML-d24-varloop-research-q4tp.cmf --local-dir .
CMF_GPU=cuda cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "Why is the sky blue? Answer in three sentences."
CMF_GPU=cuda cortiq run TML-d24-varloop-research-q4tp.cmf --loops 5 --prompt "Prove that there are infinitely many primes."
DSpark runs on CUDA with greedy decoding (--greedy, or temperature 0 through cortiq serve); CMF_INKLING_SPEC=0 turns it off. cortiq serve gives an OpenAI-compatible API, with the thinking part in message.reasoning_content and tool calls in message.tool_calls. Prebuilt binaries for Linux, macOS and Windows are on the releases page; without --features cuda the same commands run over Vulkan, Metal or the CPU. Apache-2.0, as the release.