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
File size: 2,984 Bytes
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 34 35 36 37 38 39 40 41 | """Small, fixed, hand-authored diagnostic set; not a population benchmark."""
def schema(**fields):
return {"type": "object", "properties": fields, "required": list(fields), "additionalProperties": False}
def enum(description, *values):
return {"type": "string", "description": description, "enum": list(values)}
def boolean(description):
return {"type": "boolean", "description": description}
SUPPORT = schema(
topic=enum("Main issue", "billing", "technical", "shipping"),
urgent=boolean("True only if immediate action is explicitly needed"),
refund=boolean("Whether a refund is requested"),
)
SENTIMENT = schema(
sentiment=enum("Overall sentiment", "positive", "negative", "neutral"),
language=enum("Language of the text", "English", "French", "Spanish"),
question=boolean("Whether the text asks a question"),
)
ROUTING = schema(
route=enum("Copy the exact route named in the text", "north east", "north west", "south east", "south west"),
service=enum("Requested delivery service", "standard", "express", "express plus"),
insured=boolean("Whether insurance is requested"),
)
CASES = [
("support-1", SUPPORT, "I was charged twice. Please refund the duplicate charge. This can wait until next week.", {"topic":"billing", "urgent":False,"refund":True}),
("support-2", SUPPORT, "The application crashes on startup. We need immediate action; our entire team is blocked. No refund needed.", {"topic":"technical", "urgent":True,"refund":False}),
("support-3", SUPPORT, "Where is my parcel? There is no hurry and I do not want a refund.", {"topic":"shipping", "urgent":False,"refund":False}),
("support-4", SUPPORT, "My parcel has not arrived. Please refund the shipping fee immediately; I need immediate action.", {"topic":"shipping", "urgent":True,"refund":True}),
("sentiment-1", SENTIMENT, "This product is wonderful. I love it.", {"sentiment":"positive","language":"English","question":False}),
("sentiment-2", SENTIMENT, "Ce produit est horrible. Pourquoi est-il si mauvais ?", {"sentiment":"negative","language":"French","question":True}),
("sentiment-3", SENTIMENT, "El paquete contiene tres piezas.", {"sentiment":"neutral","language":"Spanish","question":False}),
("sentiment-4", SENTIMENT, "Does the box contain three parts?", {"sentiment":"neutral","language":"English","question":True}),
("routing-1", ROUTING, "Route: north east. Service: express plus. Insurance requested.", {"route":"north east","service":"express plus","insured":True}),
("routing-2", ROUTING, "Route: north west. Service: express. No insurance.", {"route":"north west","service":"express","insured":False}),
("routing-3", ROUTING, "Route: south east. Service: standard. Insurance requested.", {"route":"south east","service":"standard","insured":True}),
("routing-4", ROUTING, "Route: south west. Service: express plus. No insurance.", {"route":"south west","service":"express plus","insured":False}),
]
|