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)# pip install -U transformers accelerate # 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=256) 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
Download rlcd/stress_tasks.py from notnotsamuel/LFM2.5-350M-RLCD: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/notnotsamuel/LFM2.5-350M-RLCD/resolve/main/rlcd/stress_tasks.py
- Command line
-
hf download hf://notnotsamuel/LFM2.5-350M-RLCD/rlcd/stress_tasks.py
-
curl -L -o stress_tasks.py https://huggingface.co/notnotsamuel/LFM2.5-350M-RLCD/resolve/main/rlcd/stress_tasks.py
1.07 kB
| """Synthetic scaling probes, reported separately from diagnostic accuracy.""" | |
| from .tasks import schema, enum, boolean | |
| CASES = [] | |
| for cardinality in [64, 255]: | |
| choices = [f"tariff_{i:03d}" for i in range(cardinality)] | |
| s = schema(tariff=enum("Copy the exact tariff code in the text", *choices)) | |
| CASES.append((f"enum-{cardinality}", s, f"The assigned tariff code is {choices[-2]}.", {"tariff": choices[-2]})) | |
| for count in [12, 28]: | |
| fields = {f"flag_{i:02d}": boolean(f"True if item {i:02d} is enabled; false if disabled") for i in range(count)} | |
| expected = {name: i % 2 == 0 for i, name in enumerate(fields)} | |
| context = "\n".join(f"Item {i:02d} is {'enabled' if i % 2 == 0 else 'disabled'}." for i in range(count)) | |
| CASES.append((f"fields-{count}", schema(**fields), context, expected)) | |
| s = schema(signal=enum("Copy the final signal color", "red", "green", "blue")) | |
| context = "Archive entries follow.\n" + "An old record was checked and filed.\n" * 160 + "\nFinal signal color: blue." | |
| CASES.append(("long-context", s, context, {"signal":"blue"})) | |