Text Generation
Transformers
Safetensors
GGUF
lfm3
liquid
depth-loop
training-free
custom_code
conversational
Instructions to use vaultpls/LFM3-1.7B-Looped with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use vaultpls/LFM3-1.7B-Looped with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="vaultpls/LFM3-1.7B-Looped", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("vaultpls/LFM3-1.7B-Looped", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("vaultpls/LFM3-1.7B-Looped", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use vaultpls/LFM3-1.7B-Looped with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf vaultpls/LFM3-1.7B-Looped:Q8_0 # Run inference directly in the terminal: llama cli -hf vaultpls/LFM3-1.7B-Looped:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf vaultpls/LFM3-1.7B-Looped:Q8_0 # Run inference directly in the terminal: llama cli -hf vaultpls/LFM3-1.7B-Looped:Q8_0
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf vaultpls/LFM3-1.7B-Looped:Q8_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf vaultpls/LFM3-1.7B-Looped:Q8_0
Use Docker
docker model run hf.co/vaultpls/LFM3-1.7B-Looped:Q8_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use vaultpls/LFM3-1.7B-Looped with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "vaultpls/LFM3-1.7B-Looped" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "vaultpls/LFM3-1.7B-Looped", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/vaultpls/LFM3-1.7B-Looped:Q8_0
- SGLang
How to use vaultpls/LFM3-1.7B-Looped 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 "vaultpls/LFM3-1.7B-Looped" \ --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": "vaultpls/LFM3-1.7B-Looped", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "vaultpls/LFM3-1.7B-Looped" \ --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": "vaultpls/LFM3-1.7B-Looped", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use vaultpls/LFM3-1.7B-Looped with Ollama:
ollama run hf.co/vaultpls/LFM3-1.7B-Looped:Q8_0
- Unsloth Desktop
- Pi
How to use vaultpls/LFM3-1.7B-Looped with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf vaultpls/LFM3-1.7B-Looped:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "vaultpls/LFM3-1.7B-Looped:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use vaultpls/LFM3-1.7B-Looped with Docker Model Runner:
docker model run hf.co/vaultpls/LFM3-1.7B-Looped:Q8_0
- Lemonade
How to use vaultpls/LFM3-1.7B-Looped with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull vaultpls/LFM3-1.7B-Looped:Q8_0
Run and chat with the model
lemonade run user.LFM3-1.7B-Looped-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use vaultpls/LFM3-1.7B-Looped with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf vaultpls/LFM3-1.7B-Looped:Q8_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default vaultpls/LFM3-1.7B-Looped:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use vaultpls/LFM3-1.7B-Looped with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf vaultpls/LFM3-1.7B-Looped:Q8_0
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "vaultpls/LFM3-1.7B-Looped:Q8_0" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Download scripts/check_loop_gguf.py from vaultpls/LFM3-1.7B-Looped: direct link, hf CLI and curl.
- Browser
- Download file 3.75 kB
-
https://huggingface.co/vaultpls/LFM3-1.7B-Looped/resolve/main/scripts/check_loop_gguf.py
- Command line
-
hf download hf://vaultpls/LFM3-1.7B-Looped/scripts/check_loop_gguf.py
-
curl -L -o check_loop_gguf.py https://huggingface.co/vaultpls/LFM3-1.7B-Looped/resolve/main/scripts/check_loop_gguf.py
3.75 kB
| #!/usr/bin/env python3 | |
| """Verify a looped GGUF: metadata arrays extended correctly + sandwich-norm scaling exact. | |
| usage: check_loop_gguf.py BASE.gguf LOOP.gguf A B [REPS] [ALPHA] | |
| """ | |
| import os, struct, sys | |
| import numpy as np | |
| SZ = {0: 1, 1: 1, 2: 2, 3: 2, 4: 4, 5: 4, 6: 4, 7: 1, 10: 8, 11: 8, 12: 8} | |
| def read(p): | |
| f = open(p, 'rb') | |
| assert f.read(4) == b'GGUF' | |
| f.read(4) | |
| nt, nkv = struct.unpack('<QQ', f.read(16)) | |
| def s(): | |
| n = struct.unpack('<Q', f.read(8))[0] | |
| return f.read(n).decode('utf-8', 'replace') | |
| def val(t): | |
| if t == 8: | |
| return s() | |
| if t == 9: | |
| et = struct.unpack('<I', f.read(4))[0] | |
| n = struct.unpack('<Q', f.read(8))[0] | |
| out = [] | |
| for _ in range(n): | |
| if et == 8: out.append(s()) | |
| elif et == 7: out.append(struct.unpack('<?', f.read(1))[0]) | |
| elif et == 6: out.append(struct.unpack('<f', f.read(4))[0]) | |
| elif et == 5: out.append(struct.unpack('<i', f.read(4))[0]) | |
| elif et == 4: out.append(struct.unpack('<I', f.read(4))[0]) | |
| elif et == 10: out.append(struct.unpack('<Q', f.read(8))[0]) | |
| else: raise ValueError(et) | |
| return out | |
| fmt = {0: '<B', 1: '<b', 2: '<H', 3: '<h', 4: '<I', 5: '<i', 6: '<f', 7: '<?', 10: '<Q', 11: '<q', 12: '<d'}[t] | |
| return struct.unpack(fmt, f.read(SZ[t]))[0] | |
| kv = {} | |
| for _ in range(nkv): | |
| k = s() | |
| t = struct.unpack('<I', f.read(4))[0] | |
| kv[k] = val(t) | |
| T = {} | |
| for _ in range(nt): | |
| name = s() | |
| nd = struct.unpack('<I', f.read(4))[0] | |
| dims = [struct.unpack('<Q', f.read(8))[0] for _ in range(nd)] | |
| tt = struct.unpack('<I', f.read(4))[0] | |
| off = struct.unpack('<Q', f.read(8))[0] | |
| T[name] = (tt, dims, off) | |
| start = (f.tell() + 31) // 32 * 32 | |
| return f, start, T, kv | |
| def raw(f, s, T, name): | |
| tt, dims, off = T[name] | |
| k = int(np.prod(dims)) | |
| f.seek(s + off) | |
| assert tt == 0, f"{name} is not f32" | |
| return np.frombuffer(f.read(k * 4), dtype=np.float32).copy() | |
| if __name__ == "__main__": | |
| base_p, loop_p = sys.argv[1], sys.argv[2] | |
| A, B = int(sys.argv[3]), int(sys.argv[4]) | |
| REPS = int(sys.argv[5]) if len(sys.argv) > 5 else 2 | |
| ALPHA = float(sys.argv[6]) if len(sys.argv) > 6 else 1.0 / REPS | |
| fA, sA, TA, kvA = read(base_p) | |
| fB, sB, TB, kvB = read(loop_p) | |
| W = B - A + 1 | |
| NEW = (REPS - 1) * W | |
| nb = kvA['lfm3.block_count'] | |
| nl = kvB['lfm3.block_count'] | |
| print(f"block_count {nb} -> {nl} (expected {nb + NEW}) {'OK' if nl == nb + NEW else 'MISMATCH'}") | |
| for key in ('lfm3.attention.head_count_kv', 'lfm3.attention.sliding_window_pattern'): | |
| want = list(kvA[key][:B + 1]) + [kvA[key][i] for _ in range(REPS - 1) for i in range(A, B + 1)] + list(kvA[key][B + 1:]) | |
| got = list(kvB[key]) | |
| print(f"{key}: {'OK' if got == want else 'MISMATCH'} (len {len(got)})") | |
| bad = 0 | |
| for i in range(A, B + 1): | |
| for nm in ('post_attention_norm.weight', 'post_ffw_norm.weight'): | |
| a = raw(fA, sA, TA, f'blk.{i}.{nm}') | |
| for rep in range(REPS): | |
| dst = i + rep * W | |
| d = np.abs(raw(fB, sB, TB, f'blk.{dst}.{nm}') - a * np.float32(ALPHA)).max() | |
| bad += int(d != 0) | |
| print(f"blk.{i}.{nm} -> blk.{dst}: max|got - {ALPHA}*base| = {d:.2e}") | |
| # untouched tensor must be byte-identical in the copy | |
| a = raw(fA, sA, TA, f'blk.{A}.attn_norm.weight') | |
| b = raw(fB, sB, TB, f'blk.{A + W}.attn_norm.weight') | |
| print(f"copy of blk.{A}.attn_norm identical: {np.array_equal(a, b)}") | |
| print("DAMPING EXACT" if bad == 0 else f"{bad} SCALE MISMATCHES") | |