pfb30/multi_woz_v22
Updated • 3.68k • 37
How to use Smilyai-labs/Sam-2.0 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Smilyai-labs/Sam-2.0") # Load model directly
from transformers import AutoProcessor, AutoModelForCausalLM
processor = AutoProcessor.from_pretrained("Smilyai-labs/Sam-2.0")
model = AutoModelForCausalLM.from_pretrained("Smilyai-labs/Sam-2.0")How to use Smilyai-labs/Sam-2.0 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Smilyai-labs/Sam-2.0"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Smilyai-labs/Sam-2.0",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Smilyai-labs/Sam-2.0
How to use Smilyai-labs/Sam-2.0 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Smilyai-labs/Sam-2.0" \
--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": "Smilyai-labs/Sam-2.0",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "Smilyai-labs/Sam-2.0" \
--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": "Smilyai-labs/Sam-2.0",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Smilyai-labs/Sam-2.0 with Docker Model Runner:
docker model run hf.co/Smilyai-labs/Sam-2.0
Sam‑2.0 is a minimal, modular, decoder‑only Transformer architecture designed for chat‑style reasoning tasks.
It emphasizes reproducibility, ablation‑friendly design, and clean benchmarking across input modalities.
sam2-epoch35.safetensors | Component | Description |
|---|---|
| Backbone | Decoder‑only Transformer stack |
| Normalization | RMSNorm |
| Attention | Multi‑head self‑attention (causal) |
| Feed‑Forward | SwiGLU activation with dropout |
| Positional Bias | Learned absolute positions (no RoPE in this minimal variant) |
| Head | Tied‑embedding LM head |
| Checkpoint Format | safetensors with metadata for reproducibility |
| Metric | Value | Notes |
|---|---|---|
| Final Train Loss | 1.04 | Achieved at Epoch 35/35 |
| Validation Loss | — | Not tracked in this run |
| Inference Speed | Fast | Lightweight architecture |
| Generalisation | TBD | To be compared against Sam‑2.5 |
sam2-epoch35.safetensors — final checkpoint config.json — architecture and training config tokenizer.json — tokenizer with special tokens README.md — training logs and setup instructionsfrom transformers import AutoTokenizer
import torch
from sam2 import Sam2, Sam2Config # your custom model class
tok = AutoTokenizer.from_pretrained("Smilyai-labs/Sam-2.0")
cfg = Sam2Config(**json.load(open("config.json")))
model = Sam2(cfg)
state = torch.load("sam2-epoch35.safetensors", map_location="cpu")
model.load_state_dict(state)
model.eval()
prompt = "<|user|> Hello! <|eot|>\n<|assistant|>"
ids = tok.encode(prompt, return_tensors="pt")
with torch.no_grad():
for _ in range(50):
logits = model(ids)
next_id = torch.argmax(logits[:, -1, :], dim=-1, keepdim=True)
ids = torch.cat([ids, next_id], dim=1)
if next_id.item() == tok.eos_token_id:
break
print(tok.decode(ids[0]))
docker model run hf.co/Smilyai-labs/Sam-2.0