Image-Text-to-Text
Transformers
Safetensors
English
Turkish
qwen3_5
loopl
on-device
agent
tool-calling
qwen3.5
sft
vision
conversational
Instructions to use cagataydev/loopl-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cagataydev/loopl-4b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="cagataydev/loopl-4b") 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("cagataydev/loopl-4b") model = AutoModelForMultimodalLM.from_pretrained("cagataydev/loopl-4b", 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 cagataydev/loopl-4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cagataydev/loopl-4b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cagataydev/loopl-4b", "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/cagataydev/loopl-4b
- SGLang
How to use cagataydev/loopl-4b 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 "cagataydev/loopl-4b" \ --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": "cagataydev/loopl-4b", "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 "cagataydev/loopl-4b" \ --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": "cagataydev/loopl-4b", "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 cagataydev/loopl-4b with Docker Model Runner:
docker model run hf.co/cagataydev/loopl-4b
card: loopl 4B v1 (bf16) — train/cards.py
Browse files
README.md
CHANGED
|
@@ -26,16 +26,16 @@ tags:
|
|
| 26 |
(model → tools → model until it answers; errors go back to the model, approvals pause the loop) and the iPhone's own
|
| 27 |
abilities as tools — vision, voice, transcription, translation, torch, haptics, deep links, memory, HTTP. Site:
|
| 28 |
[loopl.dev](https://loopl.dev) · app: [TestFlight](https://testflight.apple.com/join/uUNjfzW9) · code: [github.com/cagataycali/loopl](https://github.com/cagataycali/loopl)
|
| 29 |
-
·
|
| 30 |
|
| 31 |
**This model** is [Qwen/Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) LoRA (r=64) post-tuned by Cagatay Cali
|
| 32 |
-
([@cagataycali](https://github.com/cagataycali)) on [cagataydev/loopl-train](https://huggingface.co/datasets/cagataydev/loopl-train): how an agent loop
|
| 33 |
works and how loopl's runtime behaves, tool calling in both dialects loopl speaks (the model's native template and
|
| 34 |
loopl's JSON prompt), recovering from tool errors instead of repeating the call, who it is and who built it, and honesty
|
| 35 |
about what it does not know. The **vision tower is the base's, frozen and kept** — the MLX export reads images like
|
| 36 |
Qwen3.5 does.
|
| 37 |
|
| 38 |
-
> **This repo is the merged bf16 checkpoint** (`Qwen3_5ForConditionalGeneration`, vision included). Ready-to-run exports: [mlx](https://huggingface.co/cagataydev/loopl-4b-4bit) · [gguf](https://huggingface.co/cagataydev/loopl-4b-GGUF) · [lora](https://huggingface.co/cagataydev/loopl-4b-lora).
|
| 39 |
|
| 40 |
## Scores
|
| 41 |
|
|
@@ -62,11 +62,8 @@ python -m mlx_vlm.generate --model cagataydev/loopl-4b-4bit \
|
|
| 62 |
--image photo.jpg --prompt "What is in this picture? Then tell me who built you." --max-tokens 200
|
| 63 |
```
|
| 64 |
|
| 65 |
-
**With llama.cpp**
|
| 66 |
-
|
| 67 |
-
```bash
|
| 68 |
-
llama-cli -hf cagataydev/loopl-4b-GGUF:loopl-4b-Q4_K_M.gguf -p "Who built you, and what is 23 × 47?"
|
| 69 |
-
```
|
| 70 |
|
| 71 |
**From Swift with the loopl SDK** (`https://github.com/cagataycali/loopl`, products `Loopl` + `LooplRuntimes`):
|
| 72 |
|
|
@@ -74,7 +71,7 @@ llama-cli -hf cagataydev/loopl-4b-GGUF:loopl-4b-Q4_K_M.gguf -p "Who built you, a
|
|
| 74 |
import Loopl
|
| 75 |
import LooplRuntimes
|
| 76 |
|
| 77 |
-
let model = MLXModel() // or GGUFModel() for
|
| 78 |
try await model.load(spec, from: weightsDirectory) { _ in } // spec: the ModelSpec for cagataydev/loopl-4b-4bit; weights: the downloaded folder
|
| 79 |
|
| 80 |
let agent = Agent(model: model, tools: AppleTools.available)
|
|
@@ -83,7 +80,9 @@ for try await event in agent.stream("Torch on, then remember that I parked on le
|
|
| 83 |
}
|
| 84 |
```
|
| 85 |
|
| 86 |
-
The bf16 weights (
|
|
|
|
|
|
|
| 87 |
quantisation with `mlx_vlm.convert -q` (keeps vision) — `mlx_lm.convert` silently drops the tower.
|
| 88 |
|
| 89 |
## Recipe
|
|
@@ -91,7 +90,7 @@ quantisation with `mlx_vlm.convert -q` (keeps vision) — `mlx_lm.convert` silen
|
|
| 91 |
| | |
|
| 92 |
|---|---|
|
| 93 |
| base | [Qwen/Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) (vision tower frozen, `visual.*` never trained) |
|
| 94 |
-
| data | [cagataydev/loopl-train](https://huggingface.co/datasets/cagataydev/loopl-train) @ `e5c209dd` · 5126 rendered rows / 8,133,959 tokens · both tool dialects · oversample `c=2` |
|
| 95 |
| method | LoRA r=64 α=128 on the language model · lr 0.0001 · batch 2×8 · max_len 4096 · 2.0 epochs, best-epoch checkpoint kept |
|
| 96 |
| eval loss | ep1 1.918, ep2 1.979 → best 1.918 (eval split of the same dataset revision) |
|
| 97 |
| compute | a100-large (Hugging Face Jobs), 6741 s train · job `6ac4784afbc85ba6823b09c6` |
|
|
|
|
| 26 |
(model → tools → model until it answers; errors go back to the model, approvals pause the loop) and the iPhone's own
|
| 27 |
abilities as tools — vision, voice, transcription, translation, torch, haptics, deep links, memory, HTTP. Site:
|
| 28 |
[loopl.dev](https://loopl.dev) · app: [TestFlight](https://testflight.apple.com/join/uUNjfzW9) · code: [github.com/cagataycali/loopl](https://github.com/cagataycali/loopl)
|
| 29 |
+
· the models: [the loopl collection](https://huggingface.co/collections/cagataydev/loopl-on-device-agents-swift-6ac51395b13a9c41d4932eaf).
|
| 30 |
|
| 31 |
**This model** is [Qwen/Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) LoRA (r=64) post-tuned by Cagatay Cali
|
| 32 |
+
([@cagataycali](https://github.com/cagataycali)) on [cagataydev/loopl-train](https://huggingface.co/datasets/cagataydev/loopl-train) *(private)*: how an agent loop
|
| 33 |
works and how loopl's runtime behaves, tool calling in both dialects loopl speaks (the model's native template and
|
| 34 |
loopl's JSON prompt), recovering from tool errors instead of repeating the call, who it is and who built it, and honesty
|
| 35 |
about what it does not know. The **vision tower is the base's, frozen and kept** — the MLX export reads images like
|
| 36 |
Qwen3.5 does.
|
| 37 |
|
| 38 |
+
> **This repo is the merged bf16 checkpoint** (`Qwen3_5ForConditionalGeneration`, vision included) — **use it as the base for continual post-tuning in loopl** (Models › Train your own, or `train/loopl_sft.py --base cagataydev/loopl-4b`): every round starts from bf16, never from 4-bit weights. Ready-to-run exports: [mlx](https://huggingface.co/cagataydev/loopl-4b-4bit) *(private)* · [gguf](https://huggingface.co/cagataydev/loopl-4b-GGUF) *(private)* · [lora](https://huggingface.co/cagataydev/loopl-4b-lora) *(private)*.
|
| 39 |
|
| 40 |
## Scores
|
| 41 |
|
|
|
|
| 62 |
--image photo.jpg --prompt "What is in this picture? Then tell me who built you." --max-tokens 200
|
| 63 |
```
|
| 64 |
|
| 65 |
+
**With llama.cpp:** the GGUF Q4_K_M export (`cagataydev/loopl-4b-GGUF`) is not public yet; export your own from the bf16 weights with
|
| 66 |
+
llama.cpp's `convert_hf_to_gguf.py --no-mtp` (text only — the converter has no vision path).
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
**From Swift with the loopl SDK** (`https://github.com/cagataycali/loopl`, products `Loopl` + `LooplRuntimes`):
|
| 69 |
|
|
|
|
| 71 |
import Loopl
|
| 72 |
import LooplRuntimes
|
| 73 |
|
| 74 |
+
let model = MLXModel() // or GGUFModel() for a GGUF export
|
| 75 |
try await model.load(spec, from: weightsDirectory) { _ in } // spec: the ModelSpec for cagataydev/loopl-4b-4bit; weights: the downloaded folder
|
| 76 |
|
| 77 |
let agent = Agent(model: model, tools: AppleTools.available)
|
|
|
|
| 80 |
}
|
| 81 |
```
|
| 82 |
|
| 83 |
+
**Keep post-tuning it.** The bf16 weights ([cagataydev/loopl-4b](https://huggingface.co/cagataydev/loopl-4b) *(private)*) are the base for continual post-tuning: in the app,
|
| 84 |
+
**Models › Train your own** takes a loopl model as the base and trains on your own shared conversations (`train/loopl_sft.py
|
| 85 |
+
--base cagataydev/loopl-4b`); on a Mac they load with `transformers` ≥ 5 as `Qwen3_5ForConditionalGeneration`. Export your own
|
| 86 |
quantisation with `mlx_vlm.convert -q` (keeps vision) — `mlx_lm.convert` silently drops the tower.
|
| 87 |
|
| 88 |
## Recipe
|
|
|
|
| 90 |
| | |
|
| 91 |
|---|---|
|
| 92 |
| base | [Qwen/Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) (vision tower frozen, `visual.*` never trained) |
|
| 93 |
+
| data | [cagataydev/loopl-train](https://huggingface.co/datasets/cagataydev/loopl-train) *(private)* @ `e5c209dd` · 5126 rendered rows / 8,133,959 tokens · both tool dialects · oversample `c=2` |
|
| 94 |
| method | LoRA r=64 α=128 on the language model · lr 0.0001 · batch 2×8 · max_len 4096 · 2.0 epochs, best-epoch checkpoint kept |
|
| 95 |
| eval loss | ep1 1.918, ep2 1.979 → best 1.918 (eval split of the same dataset revision) |
|
| 96 |
| compute | a100-large (Hugging Face Jobs), 6741 s train · job `6ac4784afbc85ba6823b09c6` |
|