Text Generation
MLX
Safetensors
English
small-language-model
from-scratch
conversational
apple-silicon
research
Instructions to use OpenSML/Solstice-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use OpenSML/Solstice-1 with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("OpenSML/Solstice-1") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use OpenSML/Solstice-1 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "OpenSML/Solstice-1"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "OpenSML/Solstice-1" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenSML/Solstice-1", "messages": [ {"role": "user", "content": "Hello"} ] }' - Atomic Chat
Download scripts/plot_training.py from OpenSML/Solstice-1: direct link, hf CLI and curl.
- Browser
- Download file 2.88 kB
-
https://huggingface.co/OpenSML/Solstice-1/resolve/main/scripts/plot_training.py
- Command line
-
hf download hf://OpenSML/Solstice-1/scripts/plot_training.py
-
curl -L -o plot_training.py https://huggingface.co/OpenSML/Solstice-1/resolve/main/scripts/plot_training.py
2.88 kB
| #!/usr/bin/env python3 | |
| """Plot recorded logs; requires matplotlib 3.10.8 (not needed for inference).""" | |
| import csv | |
| import os | |
| from pathlib import Path | |
| import matplotlib | |
| matplotlib.use('Agg') | |
| import matplotlib.pyplot as plt | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def read(name): | |
| rows = list(csv.DictReader((ROOT/'results'/name).open())) | |
| return [dict(row, **{k:float(v) for k,v in row.items() if k!='phase'}) for row in rows] | |
| def main(): | |
| train = read('pretraining_steps.csv'); validation = read('pretraining_validation.csv') | |
| train = sorted({r['step']:r for r in train}.values(), key=lambda r:r['step']) | |
| validation = sorted({r['step']:r for r in validation}.values(), key=lambda r:r['step']) | |
| plt.rcParams.update({'font.family':'DejaVu Sans','font.size':10,'axes.spines.top':False,'axes.spines.right':False}) | |
| output = ROOT/'docs/figures'; output.mkdir(parents=True, exist_ok=True) | |
| for name, lower, upper in [('pretraining-overview',0,42.1),('cooldown-detail',35,42.1)]: | |
| fig, (ax, lr) = plt.subplots(2,1,figsize=(10,6.8),sharex=True,gridspec_kw={'height_ratios':[2,1]},layout='constrained') | |
| ts=[r for r in train if r['tokens']/1e9>=lower] | |
| vs=[r for r in validation if r['tokens']/1e9>=lower] | |
| ax.plot([r['tokens']/1e9 for r in ts],[r['ema'] for r in ts],color='#8898a3',lw=.9,alpha=.8,label='Training loss EMA (changing mixture)') | |
| ax.plot([r['tokens']/1e9 for r in vs],[r['reported_val_loss'] for r in vs],color='#1557a0',lw=1.5,label='Held-out prose validation (logged BF16 path)') | |
| if lower==0: ax.set_ylim(2.2,5.6) | |
| ax.set_ylabel('Token cross-entropy loss'); ax.legend(loc='upper right',fontsize=9) | |
| lr.plot([r['tokens']/1e9 for r in ts],[r['lr'] for r in ts],color='#b25819',lw=1.5) | |
| lr.set_ylabel('Learning rate'); lr.ticklabel_format(axis='y',style='sci',scilimits=(0,0)) | |
| lr.set_xlabel('Processed pretraining tokens (billions)') | |
| for panel in (ax,lr): | |
| panel.set_xlim(lower,upper); panel.grid(alpha=.16) | |
| panel.axvline(36.801216512,color='#5f6984',lw=.8,ls='--') | |
| panel.axvspan(40.001339392,42.001367040,color='#ead9ac',alpha=.4) | |
| fig.suptitle('Solstice-1 路 175M | '+('Pretraining history' if lower==0 else 'Late training and 2B-token cooldown'),fontsize=16,fontweight='bold') | |
| fig.supxlabel('Dashed line: Python/SQL introduced 路 Shaded region: final cooldown\nTraining and validation use different data; early training loss above 5.6 is outside the overview scale.' if lower==0 else 'Dashed line: Python/SQL introduced 路 Shaded region: final cooldown\nMetrics are transcribed from saved logs, with their original reported precision.',fontsize=9,color='#44505c') | |
| for ext in ('png','svg'): fig.savefig(output/f'{name}.{ext}',dpi=180) | |
| plt.close(fig) | |
| if __name__ == '__main__': | |
| main() | |