Text Generation
PEFT
Safetensors
Transformers
lora
reinforcement-learning
atari
slm-rl
space-invaders
Instructions to use yesemsanthoshkumar/slm-rl-colab with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use yesemsanthoshkumar/slm-rl-colab with PEFT:
Task type is invalid.
- Transformers
How to use yesemsanthoshkumar/slm-rl-colab with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yesemsanthoshkumar/slm-rl-colab")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("yesemsanthoshkumar/slm-rl-colab", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yesemsanthoshkumar/slm-rl-colab with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yesemsanthoshkumar/slm-rl-colab" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yesemsanthoshkumar/slm-rl-colab", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/yesemsanthoshkumar/slm-rl-colab
- SGLang
How to use yesemsanthoshkumar/slm-rl-colab 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 "yesemsanthoshkumar/slm-rl-colab" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yesemsanthoshkumar/slm-rl-colab", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "yesemsanthoshkumar/slm-rl-colab" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yesemsanthoshkumar/slm-rl-colab", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use yesemsanthoshkumar/slm-rl-colab with Docker Model Runner:
docker model run hf.co/yesemsanthoshkumar/slm-rl-colab
yesemsanthoshkumar/slm-rl-colab
PEFT LoRA adapter that warm-starts Space Invaders play for LiquidAI/LFM2.5-1.2B-Instruct in the SLM-RL workshop.
| Game | space-invaders |
| Base model | LiquidAI/LFM2.5-1.2B-Instruct |
| Adapter layout | adapter/ (PEFT adapter_config.json + weights) |
| Training | reject_sft on DQN teacher demos |
| Champion generation | 2 |
| Promoted | True (primary 0.2708 -> 0.3333, invalid_rate 0.0000, intervention_rate 0.0000) |
| Dataset pack | yesemsanthoshkumar/slm-rl-colab-data |
Paste yesemsanthoshkumar/slm-rl-colab as the playground adapter URL (and usually the same id
as the dataset URL).
Install
pip install "transformers>=4.46" peft accelerate torch
Load with transformers + PEFT
Weights live under the adapter/ subfolder — pass subfolder="adapter".
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
BASE = "LiquidAI/LFM2.5-1.2B-Instruct"
ADAPTER = "yesemsanthoshkumar/slm-rl-colab" # this repo
device = (
"cuda" if torch.cuda.is_available()
else "mps" if torch.backends.mps.is_available()
else "cpu"
)
dtype = torch.bfloat16 if device != "cpu" else torch.float32
tokenizer = AutoTokenizer.from_pretrained(BASE)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
model = AutoModelForCausalLM.from_pretrained(BASE, torch_dtype=dtype)
model = PeftModel.from_pretrained(model, ADAPTER, subfolder="adapter")
model.to(device).eval()
messages = [
{"role": "system", "content": "You play Space Invaders. Reply with ACTION: <id>."},
{"role": "user", "content": "Legal actions: 1) NOOP 2) UP\nChoose."},
]
prompt = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, tokenize=False,
)
inputs = tokenizer(prompt, return_tensors="pt").to(device)
with torch.inference_mode():
out = model.generate(**inputs, max_new_tokens=24, do_sample=False)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Download only the adapter files
from huggingface_hub import snapshot_download
path = snapshot_download("yesemsanthoshkumar/slm-rl-colab", allow_patterns="adapter/*")
# then: PeftModel.from_pretrained(base_model, f"{path}/adapter")
Workshop / SLM-RL CLI
slm-rl evolve --game space-invaders \
--dataset-url yesemsanthoshkumar/slm-rl-colab-data \
--adapter-url yesemsanthoshkumar/slm-rl-colab \
--generations 2
Train metrics (if recorded)
{
"eval": {
"episodes": 8,
"intervention_rate": 0.0,
"invalid_rate": 0.0,
"mean_entropy": null,
"mean_score": 0.3333333333333333,
"primary": 0.3333333333333333,
"win_rate": 0.0
},
"gate": {
"promoted": true,
"reason": "primary 0.2708 -> 0.3333, invalid_rate 0.0000, intervention_rate 0.0000"
},
"train": {
"entropy": 2.897462248802185,
"frac_reward_zero_std": 0.75,
"kl": 0.3121398240327835,
"loss": -0.016890665888786315,
"num_prompts": 16,
"reward": 0.15625
}
}
Trained with SLM-RL.
- Downloads last month
- -
Model tree for yesemsanthoshkumar/slm-rl-colab
Base model
LiquidAI/LFM2.5-1.2B-Base Finetuned
LiquidAI/LFM2.5-1.2B-Instruct