Text Generation
GGUF
English
supermongo
astronomy
code-generation
scientific-plotting
conversational
Instructions to use xpol555/sm-coder-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use xpol555/sm-coder-gguf with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf xpol555/sm-coder-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf xpol555/sm-coder-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf xpol555/sm-coder-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf xpol555/sm-coder-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf xpol555/sm-coder-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf xpol555/sm-coder-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf xpol555/sm-coder-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf xpol555/sm-coder-gguf:Q4_K_M
Use Docker
docker model run hf.co/xpol555/sm-coder-gguf:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use xpol555/sm-coder-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xpol555/sm-coder-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xpol555/sm-coder-gguf", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/xpol555/sm-coder-gguf:Q4_K_M
- Ollama
How to use xpol555/sm-coder-gguf with Ollama:
ollama run hf.co/xpol555/sm-coder-gguf:Q4_K_M
- Unsloth Studio
How to use xpol555/sm-coder-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for xpol555/sm-coder-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for xpol555/sm-coder-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for xpol555/sm-coder-gguf to start chatting
- Pi
How to use xpol555/sm-coder-gguf with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf xpol555/sm-coder-gguf:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "xpol555/sm-coder-gguf:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use xpol555/sm-coder-gguf with Docker Model Runner:
docker model run hf.co/xpol555/sm-coder-gguf:Q4_K_M
- Lemonade
How to use xpol555/sm-coder-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull xpol555/sm-coder-gguf:Q4_K_M
Run and chat with the model
lemonade run user.sm-coder-gguf-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use xpol555/sm-coder-gguf with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf xpol555/sm-coder-gguf:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default xpol555/sm-coder-gguf:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use xpol555/sm-coder-gguf with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf xpol555/sm-coder-gguf:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "xpol555/sm-coder-gguf:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload model README
Browse files
README.md
CHANGED
|
@@ -1,128 +1,81 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
-
|
| 4 |
-
on SuperMongo examples and export a quantized GGUF model for Ollama.
|
| 5 |
|
| 6 |
-
|
| 7 |
|
| 8 |
-
|
| 9 |
-
- `1b_alignment.jsonl`: targeted alignment examples (identity + anti-pseudo-syntax)
|
| 10 |
-
- `2_finetune_unsloth.py`: LoRA fine-tuning (Unsloth)
|
| 11 |
-
- `3_merge_weights.py`: merge LoRA into full model
|
| 12 |
-
- `4_convert_gguf.py`: HF -> GGUF + Q4_K_M quantization
|
| 13 |
-
- `5_build_mlc.py`: build MLC/WebLLM artifacts from merged model
|
| 14 |
-
- `6_publish_hf.py`: publish GGUF and/or MLC artifacts to Hugging Face
|
| 15 |
-
- `Modelfile.finetuned`: Ollama model definition
|
| 16 |
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
-
nvidia-smi
|
| 23 |
-
python3 -c "import torch; print(torch.cuda.is_available())"
|
| 24 |
-
```
|
| 25 |
-
|
| 26 |
-
### Environment Setup
|
| 27 |
-
|
| 28 |
-
From `sm_llm/`:
|
| 29 |
-
|
| 30 |
-
```bash
|
| 31 |
-
uv sync --extra train
|
| 32 |
-
```
|
| 33 |
-
|
| 34 |
-
If you are using an already active venv, use `--active` in `uv run`.
|
| 35 |
-
|
| 36 |
-
### Build llama.cpp (submodule)
|
| 37 |
-
|
| 38 |
-
The conversion script expects `llama.cpp` at `./llama.cpp` (submodule path).
|
| 39 |
-
|
| 40 |
-
```bash
|
| 41 |
-
cd llama.cpp
|
| 42 |
-
cmake -B build
|
| 43 |
-
cmake --build build -j
|
| 44 |
-
cd ..
|
| 45 |
-
```
|
| 46 |
-
|
| 47 |
-
### Train + Export
|
| 48 |
-
|
| 49 |
-
```bash
|
| 50 |
-
uv run --active --extra train python 2_finetune_unsloth.py
|
| 51 |
-
uv run --active --extra train python 3_merge_weights.py
|
| 52 |
-
uv run --active --extra train python 4_convert_gguf.py
|
| 53 |
-
```
|
| 54 |
|
| 55 |
-
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
-
- `merged_model/`
|
| 59 |
-
- `gguf/sm-coder-1.5b-q4_k_m.gguf`
|
| 60 |
|
| 61 |
-
|
| 62 |
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
-
|
| 66 |
-
ollama create sm-coder -f Modelfile.finetuned
|
| 67 |
-
ollama run sm-coder
|
| 68 |
-
```
|
| 69 |
-
|
| 70 |
-
### Build MLC (WebLLM)
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
|
| 76 |
-
|
| 77 |
-
uv pip install --pre -U --find-links https://mlc.ai/wheels mlc-llm-nightly-cu130 mlc-ai-nightly-cu130
|
| 78 |
-
```
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
|
|
|
| 82 |
|
| 83 |
-
|
| 84 |
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
|
| 89 |
-
|
| 90 |
|
| 91 |
-
|
| 92 |
-
- `mlc_dist/lib/*.wasm`
|
| 93 |
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
| 100 |
```
|
| 101 |
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
```
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
```bash
|
| 111 |
-
uv run --active --extra publish python 6_publish_hf.py \
|
| 112 |
-
--gguf-repo your-user/sm-coder-gguf
|
| 113 |
-
```
|
| 114 |
-
|
| 115 |
-
Publish both GGUF and MLC artifacts:
|
| 116 |
-
|
| 117 |
-
```bash
|
| 118 |
-
uv run --active --extra publish python 6_publish_hf.py \
|
| 119 |
-
--gguf-repo your-user/sm-coder-gguf \
|
| 120 |
-
--mlc-repo your-user/sm-coder-mlc
|
| 121 |
-
```
|
| 122 |
-
|
| 123 |
-
Use `--private` if you want private repositories.
|
| 124 |
-
|
| 125 |
-
### Notes
|
| 126 |
|
| 127 |
-
-
|
| 128 |
-
-
|
|
|
|
|
|
| 1 |
+
# SM Coder 1.5B
|
| 2 |
|
| 3 |
+
SM Coder is a fine-tuned coding assistant focused on SuperMongo (SM) macro development for scientific plotting workflows.
|
|
|
|
| 4 |
|
| 5 |
+
This README is intended as the public model card for Hugging Face uploads.
|
| 6 |
|
| 7 |
+
## Model Repositories
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
- GGUF (Ollama / llama.cpp): https://huggingface.co/xpol555/sm-coder-gguf
|
| 10 |
+
- MLC (WebLLM / browser deployment): https://huggingface.co/xpol555/sm-coder-mlc
|
| 11 |
|
| 12 |
+
## What Is SuperMongo
|
| 13 |
|
| 14 |
+
SuperMongo is a plotting and data-analysis environment widely used in astronomy and scientific workflows.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
Reference:
|
| 17 |
+
- https://www.astro.princeton.edu/~rhl/sm/
|
| 18 |
|
| 19 |
+
## Dataset and Scope
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
This model was developed on a curated dataset of SM macros and related examples collected and evolved over about 20 years of real usage.
|
| 22 |
|
| 23 |
+
The training data emphasizes:
|
| 24 |
+
- reusable plotting macros
|
| 25 |
+
- parameterized workflow helpers
|
| 26 |
+
- practical data visualization patterns used in long-running scientific analysis
|
| 27 |
|
| 28 |
+
## Intended Use
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
- writing and refactoring SuperMongo macros
|
| 31 |
+
- translating plotting requests into SM macro skeletons
|
| 32 |
+
- helping document and modernize legacy macro collections
|
| 33 |
|
| 34 |
+
## Not Intended As
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
- a general-purpose chatbot
|
| 37 |
+
- an authoritative source on non-SM domains
|
| 38 |
+
- a replacement for validation/testing of scientific plots
|
| 39 |
|
| 40 |
+
## Example Prompts
|
| 41 |
|
| 42 |
+
- "Write an SM macro to draw concentric circles with configurable center and step."
|
| 43 |
+
- "Create an SM macro that computes min/max from two vectors and sets plotting limits."
|
| 44 |
+
- "Refactor this old SM macro into smaller parameterized helpers."
|
| 45 |
|
| 46 |
+
## Example Macro Ideas
|
| 47 |
|
| 48 |
+
The model can propose macro structures like these (adapt names and details to your local SM setup):
|
|
|
|
| 49 |
|
| 50 |
+
```sm
|
| 51 |
+
define draw_circle (xc,yc,r,npt) {
|
| 52 |
+
set _th = 2*3.14159265*indgen(npt)/npt
|
| 53 |
+
set _x = xc + r*cos(_th)
|
| 54 |
+
set _y = yc + r*sin(_th)
|
| 55 |
+
connect _x _y
|
| 56 |
+
}
|
| 57 |
|
| 58 |
+
define draw_concentric (xc,yc,r0,dr,nr,npt) {
|
| 59 |
+
do i = 0, nr-1 {
|
| 60 |
+
set _r = r0 + i*dr
|
| 61 |
+
draw_circle(xc,yc,_r,npt)
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
```
|
| 65 |
|
| 66 |
+
```sm
|
| 67 |
+
define autoscale_xy (xv,yv,pad) {
|
| 68 |
+
set _xmin = min(xv)
|
| 69 |
+
set _xmax = max(xv)
|
| 70 |
+
set _ymin = min(yv)
|
| 71 |
+
set _ymax = max(yv)
|
| 72 |
+
limits (_xmin-pad) (_xmax+pad) (_ymin-pad) (_ymax+pad)
|
| 73 |
+
box
|
| 74 |
+
}
|
| 75 |
```
|
| 76 |
|
| 77 |
+
## Notes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
+
- Validate generated macros against your SM version and local macro library.
|
| 80 |
+
- For browser usage, prefer the MLC repository.
|
| 81 |
+
- For local inference with Ollama/llama.cpp, prefer the GGUF repository.
|