Text Generation
Transformers
Safetensors
GGUF
English
code
code-generation
multimodal
llama
conversational
Instructions to use mrsandip/Alfa-Code with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mrsandip/Alfa-Code with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mrsandip/Alfa-Code")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mrsandip/Alfa-Code", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mrsandip/Alfa-Code 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 mrsandip/Alfa-Code:Q4_0 # Run inference directly in the terminal: llama cli -hf mrsandip/Alfa-Code:Q4_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mrsandip/Alfa-Code:Q4_0 # Run inference directly in the terminal: llama cli -hf mrsandip/Alfa-Code:Q4_0
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 mrsandip/Alfa-Code:Q4_0 # Run inference directly in the terminal: ./llama-cli -hf mrsandip/Alfa-Code:Q4_0
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 mrsandip/Alfa-Code:Q4_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf mrsandip/Alfa-Code:Q4_0
Use Docker
docker model run hf.co/mrsandip/Alfa-Code:Q4_0
- LM Studio
- Jan
- vLLM
How to use mrsandip/Alfa-Code with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mrsandip/Alfa-Code" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrsandip/Alfa-Code", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mrsandip/Alfa-Code:Q4_0
- SGLang
How to use mrsandip/Alfa-Code 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 "mrsandip/Alfa-Code" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrsandip/Alfa-Code", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "mrsandip/Alfa-Code" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrsandip/Alfa-Code", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use mrsandip/Alfa-Code with Ollama:
ollama run hf.co/mrsandip/Alfa-Code:Q4_0
- Unsloth Desktop
- Docker Model Runner
How to use mrsandip/Alfa-Code with Docker Model Runner:
docker model run hf.co/mrsandip/Alfa-Code:Q4_0
- Lemonade
How to use mrsandip/Alfa-Code with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mrsandip/Alfa-Code:Q4_0
Run and chat with the model
lemonade run user.Alfa-Code-Q4_0
List all available models
lemonade list
- Atomic Chat
File size: 3,314 Bytes
147855a 364d30a 50f063a 147855a b578034 50f063a 7f2a053 9f336b6 50f063a d31fa75 50f063a b578034 d5743c4 b578034 d5743c4 50f063a d5743c4 b578034 50f063a b578034 d5743c4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | ---
license: apache-2.0
language:
- en
pipeline_tag: text-generation
library_name: transformers
tags:
- code
- code-generation
- multimodal
- gguf
- llama
datasets:
- HuggingFaceH4/CodeAlpaca_20K
metrics:
- code_eval
- perplexity
version: 0.0.2
---
# Alfa Code - Multimodal Coding GGUF
Llama-based code models, trained on Kaggle T4. Ready-to-run GGUF weights below.
## Download (ready weights)
**GitHub release:** https://github.com/mrsandipmandal/alfa-code/releases/tag/v0.0.2
**HuggingFace:** https://huggingface.co/mrsandip/Alfa-Code/tree/main/gguf
| Model | Q8_0 (best) | Q4_0 (small) | Context |
|---|---|---|---|
| tiny-50M (56M) | [tiny-50M-q8.gguf](https://huggingface.co/mrsandip/Alfa-Code/resolve/main/gguf/tiny-50M-q8.gguf) (60 MB) | [tiny-50M-q4.gguf](https://huggingface.co/mrsandip/Alfa-Code/resolve/main/gguf/tiny-50M-q4.gguf) (32 MB) | 2048 |
| base-1B (1.1B) | [base-1B-q8.gguf](https://huggingface.co/mrsandip/Alfa-Code/resolve/main/gguf/base-1B-q8.gguf) (1.19 GB) | [base-1B-q4.gguf](https://huggingface.co/mrsandip/Alfa-Code/resolve/main/gguf/base-1B-q4.gguf) (632 MB) | 2048 |
| code-100k (1.39B) | ~~code-100k-Q8_0.gguf~~ | ~~code-100k-Q4_0.gguf~~ | — |
> code-100k files deprecated (broken tokenizer build, model dropped). Current line: tiny-50M + base-1B (fixed build: faithful HF-identical tokenization, embedded chat template). Next: `alfa-code-1.2` (this branch).
> code-100k is an early checkpoint (1 epoch, eval loss ~3.1) — loads and runs, but output quality is rough. More training coming.
```bash
llama-server -m base-1B-q4.gguf -c 2048
llama-server -m tiny-50M-q8.gguf -c 2048
```
Tokenizer (32k BPE): `tokenizers/alfa-32k.json` — also in the v0.0.2 release assets.
## 1. Data
`python scripts/download_data.py --dataset code_small_test --max-rows 500`
Output: `data/processed/train.jsonl` {modality,prompt,think,answer}
## 2. Tokenizer + Train
`python scripts/train_tokenizer.py` -> `tokenizers/alfa-32k.json` (32000 vocab, ~419KB)
`pip install torch --index-url https://download.pytorch.org/whl/cu121`
`python scripts/train.py` -> `outputs/tiny-50M`
Scale-up (Colab T4, ~2-4h): 5000+ rows, chat tuning, 3-5 epochs:
`python scripts/download_data.py --dataset multimodal_mix --max-rows 5000 --overwrite`
`python scripts/download_data.py --dataset chat_qa --max-rows 2000` (appends Q&A rows)
`python scripts/train_hf.py --data data/processed/train.jsonl --out /content/outputs/tiny-50M --epochs 3 --config configs/tiny-50M.yaml --max-seq-len 2048 --batch-size 1`
1B model (16GB+ GPU only, not RTX 3050 4GB): same commands with `--config configs/base-1B.yaml --out /content/outputs/base-1B` (1.12B params, ~2.2GB fp16).
## 3. GGUF (no llama.cpp clone needed)
`pip install gguf safetensors torch transformers`
`python scripts/convert_to_gguf.py --ckpt outputs/tiny-50M --quant Q8_0` (Q8_0 ~55MB, Q4_0 ~32MB, F16 ~105MB)
K-quants (Q4_K_M) need standard dims + `llama-quantize` binary — not offered (intermediate 1376).
Run local (RTX 3050 4GB):
`llama-server -m outputs/tiny-50M.gguf -c 2048` or Ollama Modelfile (`FROM ./outputs/tiny-50M.gguf`).
## 4. UI (reasoning live->collapsed + image/file/video)
`python app/ui.py` -> http://127.0.0.1:7860
## 5. Hub sync
`hf upload mrsandip/Alfa-Code . . --exclude __pycache__ --exclude .venv --commit-message "Update"`
|