Text Generation
Transformers
Safetensors
PyTorch
English
French
Spanish
lfm2
classification
inference-only
structured-generation
constrained-decoding
apple-silicon
conversational
Instructions to use notnotsamuel/LFM2.5-350M-RLCD with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use notnotsamuel/LFM2.5-350M-RLCD with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="notnotsamuel/LFM2.5-350M-RLCD") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("notnotsamuel/LFM2.5-350M-RLCD") model = AutoModelForCausalLM.from_pretrained("notnotsamuel/LFM2.5-350M-RLCD", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use notnotsamuel/LFM2.5-350M-RLCD with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "notnotsamuel/LFM2.5-350M-RLCD" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "notnotsamuel/LFM2.5-350M-RLCD", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/notnotsamuel/LFM2.5-350M-RLCD
- SGLang
How to use notnotsamuel/LFM2.5-350M-RLCD 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 "notnotsamuel/LFM2.5-350M-RLCD" \ --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": "notnotsamuel/LFM2.5-350M-RLCD", "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 "notnotsamuel/LFM2.5-350M-RLCD" \ --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": "notnotsamuel/LFM2.5-350M-RLCD", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use notnotsamuel/LFM2.5-350M-RLCD with Docker Model Runner:
docker model run hf.co/notnotsamuel/LFM2.5-350M-RLCD
File size: 1,841 Bytes
a99edfc deb589d a99edfc deb589d a99edfc deb589d a99edfc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | """Assemble a local release directory. Deliberately has no network/upload code."""
import hashlib
import json
import shutil
from pathlib import Path
def file_sha256(path):
with path.open("rb") as source:
return hashlib.file_digest(source, "sha256").hexdigest()
root = Path(__file__).resolve().parents[1]
destination = root / "release" / "notnotsamuel" / "LFM2.5-350M-RLCD"
destination.mkdir(parents=True, exist_ok=True)
files = [root / f for f in ["README.md", "LICENSE", "LICENSE-CODE", "requirements.txt", "modal_benchmark.py", ".gitignore", "BASE_MODEL_MANIFEST.json", "model.safetensors", "config.json", "generation_config.json", "tokenizer.json", "tokenizer_config.json", "chat_template.jinja"]]
for directory in ["rlcd", "tests", "scripts", "docs"]:
files.extend(p for p in (root / directory).rglob("*") if p.is_file() and "__pycache__" not in p.parts)
files.extend((root / "results").glob("*.json"))
files.extend(root / "results" / f for f in ["REPORT.md", "local-tests.log", "environment-macos.txt"])
files.extend((root / "results" / "exploratory").glob("*.json"))
for source in files:
relative = source.relative_to(root)
target = destination / relative
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(source, target)
manifest = {"target_repository": "notnotsamuel/LFM2.5-350M-RLCD", "status": "release",
"base_model": "LiquidAI/LFM2.5-350M", "base_revision": "9e6c6ccf47cd318696e137d381a7ded8fe4df09f",
"contains_weights": True, "weights_modified": False, "training_performed": False,
"files_sha256": {str(p.relative_to(root)):file_sha256(p) for p in sorted(files)}}
(destination / "RELEASE_MANIFEST.json").write_text(json.dumps(manifest, indent=2) + "\n")
print(destination)
print(f"Prepared {len(files)} files; no network operation performed.")
|