Text Generation
Transformers
GGUF
English
code
python
small-model
pretrained-from-scratch
gpt2
from-scratch
coding
SLM
Instructions to use Rohanify/PyBlissa-Coder-50M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Rohanify/PyBlissa-Coder-50M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Rohanify/PyBlissa-Coder-50M")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Rohanify/PyBlissa-Coder-50M", dtype="auto") - llama-cpp-python
How to use Rohanify/PyBlissa-Coder-50M with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Rohanify/PyBlissa-Coder-50M", filename="PyBlissa-Coder-50M-F32.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Rohanify/PyBlissa-Coder-50M 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 Rohanify/PyBlissa-Coder-50M:F32 # Run inference directly in the terminal: llama cli -hf Rohanify/PyBlissa-Coder-50M:F32
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Rohanify/PyBlissa-Coder-50M:F32 # Run inference directly in the terminal: llama cli -hf Rohanify/PyBlissa-Coder-50M:F32
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 Rohanify/PyBlissa-Coder-50M:F32 # Run inference directly in the terminal: ./llama-cli -hf Rohanify/PyBlissa-Coder-50M:F32
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 Rohanify/PyBlissa-Coder-50M:F32 # Run inference directly in the terminal: ./build/bin/llama-cli -hf Rohanify/PyBlissa-Coder-50M:F32
Use Docker
docker model run hf.co/Rohanify/PyBlissa-Coder-50M:F32
- LM Studio
- Jan
- vLLM
How to use Rohanify/PyBlissa-Coder-50M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Rohanify/PyBlissa-Coder-50M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Rohanify/PyBlissa-Coder-50M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Rohanify/PyBlissa-Coder-50M:F32
- SGLang
How to use Rohanify/PyBlissa-Coder-50M 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 "Rohanify/PyBlissa-Coder-50M" \ --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": "Rohanify/PyBlissa-Coder-50M", "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 "Rohanify/PyBlissa-Coder-50M" \ --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": "Rohanify/PyBlissa-Coder-50M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use Rohanify/PyBlissa-Coder-50M with Ollama:
ollama run hf.co/Rohanify/PyBlissa-Coder-50M:F32
- Unsloth Studio
How to use Rohanify/PyBlissa-Coder-50M 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 Rohanify/PyBlissa-Coder-50M 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 Rohanify/PyBlissa-Coder-50M to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Rohanify/PyBlissa-Coder-50M to start chatting
- Atomic Chat new
- Docker Model Runner
How to use Rohanify/PyBlissa-Coder-50M with Docker Model Runner:
docker model run hf.co/Rohanify/PyBlissa-Coder-50M:F32
- Lemonade
How to use Rohanify/PyBlissa-Coder-50M with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Rohanify/PyBlissa-Coder-50M:F32
Run and chat with the model
lemonade run user.PyBlissa-Coder-50M-F32
List all available models
lemonade list
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,113 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- code
|
| 9 |
+
- python
|
| 10 |
+
- gguf
|
| 11 |
+
- small-model
|
| 12 |
+
- pretrained-from-scratch
|
| 13 |
+
- gpt2
|
| 14 |
+
- from-scratch
|
| 15 |
+
- coding
|
| 16 |
+
- SLM
|
| 17 |
---
|
| 18 |
+
|
| 19 |
+
# PyBlissa-Coder-50M
|
| 20 |
+
|
| 21 |
+
A 50M-parameter Python code generation model trained from scratch on a single RTX 5080. Built as part of the **PRIME** lineup of small, locally-runnable AI systems.
|
| 22 |
+
|
| 23 |
+
Despite its size, PyBlissa punches well above its weight on Python instruction-following tasks. Trained near-Chinchilla optimal (~13 tokens/parameter) for maximum capacity utilization.
|
| 24 |
+
|
| 25 |
+
[loss_visualization.png]
|
| 26 |
+
|
| 27 |
+
## Stats
|
| 28 |
+
|
| 29 |
+
| | |
|
| 30 |
+
|---|---|
|
| 31 |
+
| Parameters | 50.2M |
|
| 32 |
+
| Architecture | Decoder-only transformer (GPT-2 style) |
|
| 33 |
+
| Context length | 1024 tokens |
|
| 34 |
+
| Vocab size | 16,000 (custom ByteLevel BPE) |
|
| 35 |
+
| Train tokens | 166M |
|
| 36 |
+
| Final val loss | 0.474 |
|
| 37 |
+
| Training time | 73 minutes (RTX 5080) |
|
| 38 |
+
|
| 39 |
+
## Architecture
|
| 40 |
+
|
| 41 |
+
```
|
| 42 |
+
d_model: 640
|
| 43 |
+
n_layer: 8
|
| 44 |
+
n_head: 8
|
| 45 |
+
d_ff: 2560
|
| 46 |
+
block_size: 1024
|
| 47 |
+
tied embeddings, pre-LN, no bias, GELU MLP, SDPA attention
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Training data
|
| 51 |
+
|
| 52 |
+
Two-source code-instruction corpus, 425k samples β 166M tokens after BPE tokenization:
|
| 53 |
+
|
| 54 |
+
- **`nvidia/OpenCodeInstruct`** β 400k high-quality instruction-code pairs
|
| 55 |
+
- **`flytech/python-codes-25k`** β 25k Python-focused instruction-code pairs
|
| 56 |
+
|
| 57 |
+
Trained for 4 epochs with cosine LR schedule (3e-4 β 3e-5), bf16 autocast, batch size 20.
|
| 58 |
+
|
| 59 |
+
## Prompt format
|
| 60 |
+
|
| 61 |
+
Trained on a strict prefix structure:
|
| 62 |
+
|
| 63 |
+
```
|
| 64 |
+
PROMPT: <your instruction>
|
| 65 |
+
CODE:
|
| 66 |
+
<generated code>
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
Anything else is out-of-distribution. The Modelfile in this repo handles the formatting automatically.
|
| 70 |
+
|
| 71 |
+
## Usage β Ollama (recommended)
|
| 72 |
+
|
| 73 |
+
```bash
|
| 74 |
+
ollama run hf.co/Rohanify/PyBlissa-Coder-50M
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
Or pull the GGUF directly and create locally:
|
| 78 |
+
|
| 79 |
+
```bash
|
| 80 |
+
ollama create pyblissa-coder -f Modelfile
|
| 81 |
+
ollama run pyblissa-coder "write a function to merge two sorted lists"
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
## Usage β llama.cpp
|
| 85 |
+
|
| 86 |
+
```bash
|
| 87 |
+
./llama-cli -m PyBlissa-Coder-50M-F32.gguf \
|
| 88 |
+
-p "PROMPT: write a function to reverse a string\nCODE:\n" \
|
| 89 |
+
--temp 0.8 --top-k 50 --top-p 0.95 -n 256
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
## Files
|
| 93 |
+
|
| 94 |
+
| File | Purpose |
|
| 95 |
+
|---|---|
|
| 96 |
+
| `PyBlissa-Coder-50M-F32.gguf` | Full-precision GGUF weights |
|
| 97 |
+
| `Modelfile` | Ollama config (prompt template, stop tokens, sampling) |
|
| 98 |
+
| `tokenizer.json` | Custom 16k BPE tokenizer |
|
| 99 |
+
|
| 100 |
+
## Limitations
|
| 101 |
+
|
| 102 |
+
- Python-only β other languages weren't in training data
|
| 103 |
+
- 1024-token context β longer programs get truncated
|
| 104 |
+
- Small flytech subset (~6% of training data) contains code with unescaped quote bugs; the model occasionally inherits this pattern
|
| 105 |
+
- No safety tuning, no RLHF β base model only
|
| 106 |
+
|
| 107 |
+
## Acknowledgments
|
| 108 |
+
|
| 109 |
+
Datasets by NVIDIA and flytech. Built using the nanoGPT-style training recipe with custom tokenization. Tooling: PyTorch, HuggingFace `tokenizers`, llama.cpp for GGUF conversion.
|
| 110 |
+
|
| 111 |
+
---
|
| 112 |
+
|
| 113 |
+
Made by Rohan. Also known as ElectroPlayin on YouTube
|