Text Generation
Transformers
Safetensors
GGUF
English
gpt_bigcode
code
python
instruct
conversational
text-generation-inference
Run this model with HF Jobs
Run Kuantum-ai1/TinyCode1.1-164M-Python-Instruct on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/Kuantum-ai1/TinyCode1.1-164M-Python-Instruct. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Kuantum-ai1/TinyCode1.1-164M-Python-Instruct on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/Kuantum-ai1/TinyCode1.1-164M-Python-Instruct. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use Kuantum-ai1/TinyCode1.1-164M-Python-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kuantum-ai1/TinyCode1.1-164M-Python-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kuantum-ai1/TinyCode1.1-164M-Python-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Kuantum-ai1/TinyCode1.1-164M-Python-Instruct") model = AutoModelForCausalLM.from_pretrained("Kuantum-ai1/TinyCode1.1-164M-Python-Instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Kuantum-ai1/TinyCode1.1-164M-Python-Instruct 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 Kuantum-ai1/TinyCode1.1-164M-Python-Instruct:Q4_K_M # Run inference directly in the terminal: llama cli -hf Kuantum-ai1/TinyCode1.1-164M-Python-Instruct:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Kuantum-ai1/TinyCode1.1-164M-Python-Instruct:Q4_K_M # Run inference directly in the terminal: llama cli -hf Kuantum-ai1/TinyCode1.1-164M-Python-Instruct:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf Kuantum-ai1/TinyCode1.1-164M-Python-Instruct:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf Kuantum-ai1/TinyCode1.1-164M-Python-Instruct:Q4_K_M
Use Docker
docker model run hf.co/Kuantum-ai1/TinyCode1.1-164M-Python-Instruct:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use Kuantum-ai1/TinyCode1.1-164M-Python-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kuantum-ai1/TinyCode1.1-164M-Python-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kuantum-ai1/TinyCode1.1-164M-Python-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Kuantum-ai1/TinyCode1.1-164M-Python-Instruct:Q4_K_M
- SGLang
How to use Kuantum-ai1/TinyCode1.1-164M-Python-Instruct 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 "Kuantum-ai1/TinyCode1.1-164M-Python-Instruct" \ --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": "Kuantum-ai1/TinyCode1.1-164M-Python-Instruct", "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 "Kuantum-ai1/TinyCode1.1-164M-Python-Instruct" \ --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": "Kuantum-ai1/TinyCode1.1-164M-Python-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use Kuantum-ai1/TinyCode1.1-164M-Python-Instruct with Ollama:
ollama run hf.co/Kuantum-ai1/TinyCode1.1-164M-Python-Instruct:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use Kuantum-ai1/TinyCode1.1-164M-Python-Instruct with Docker Model Runner:
docker model run hf.co/Kuantum-ai1/TinyCode1.1-164M-Python-Instruct:Q4_K_M
- Lemonade
How to use Kuantum-ai1/TinyCode1.1-164M-Python-Instruct with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Kuantum-ai1/TinyCode1.1-164M-Python-Instruct:Q4_K_M
Run and chat with the model
lemonade run user.TinyCode1.1-164M-Python-Instruct-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Upload folder using huggingface_hub
Browse filesFiles changed (14)
- .gitattributes+6
- README.mdAdded+83
- TinyCode1.1-164M-Python-Instruct-Q4_0.ggufAdded+3
- TinyCode1.1-164M-Python-Instruct-Q4_K_M.ggufAdded+3
- TinyCode1.1-164M-Python-Instruct-Q4_K_S.ggufAdded+3
- TinyCode1.1-164M-Python-Instruct-Q5_K_M.ggufAdded+3
- TinyCode1.1-164M-Python-Instruct-Q6_K.ggufAdded+3
- TinyCode1.1-164M-Python-Instruct-Q8_0.ggufAdded+3
- chat_template.jinjaAdded+5
- config.jsonAdded+42
- generation_config.jsonAdded+6
- model.safetensorsAdded+3
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+33
32 unmodified lines33343536373839404132 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textTinyCode1.1-164M-Python-Instruct-Q4_0.gguf filter=lfs diff=lfs merge=lfs -textTinyCode1.1-164M-Python-Instruct-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -textTinyCode1.1-164M-Python-Instruct-Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -textTinyCode1.1-164M-Python-Instruct-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -textTinyCode1.1-164M-Python-Instruct-Q6_K.gguf filter=lfs diff=lfs merge=lfs -textTinyCode1.1-164M-Python-Instruct-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283---license: bigcode-openrail-mlanguage:- enlibrary_name: transformerspipeline_tag: text-generationbase_model: Kuantum-ai1/TinyCode1.1-164M-Pythontags:- code- python- instruct---
# TinyCode1.1-164M-Python-Instruct
A small Python instruction-tuned model: [`Kuantum-ai1/TinyCode1.1-164M-Python`](https://huggingface.co/Kuantum-ai1/TinyCode1.1-164M-Python) fine-tuned on 25M tokens (2 epochs) of Python instruction pairs plus plain Python code. It answers a request with one fenced Python code block.
## Prompt format
```### Instruction:{your request}
### Response:```python```
The model writes the code and a closing code fence, then stops (EOS). `tokenizer.apply_chat_template` produces this format. Pre-filling the opening code fence (see Usage) works best.
## Training
- Base model: `Kuantum-ai1/TinyCode1.1-164M-Python`- Data (25M tokens): 18.7M tokens of instruction pairs (response = the Python code block of the answer; loss only on the response) from [`iamtarun/python_code_instructions_18k_alpaca`](https://huggingface.co/datasets/iamtarun/python_code_instructions_18k_alpaca), [`nickrosh/Evol-Instruct-Code-80k-v1`](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1), [`bigcode/self-oss-instruct-sc2-exec-filter-50k`](https://huggingface.co/datasets/bigcode/self-oss-instruct-sc2-exec-filter-50k) and [`ise-uiuc/Magicoder-OSS-Instruct-75K`](https://huggingface.co/datasets/ise-uiuc/Magicoder-OSS-Instruct-75K), plus 6.3M tokens of plain Python from [`jon-tow/starcoderdata-python-edu`](https://huggingface.co/datasets/jon-tow/starcoderdata-python-edu) to keep completion ability. Several of these datasets are LLM-generated; check their licenses before commercial use.- Filtering: valid Python (`ast.parse`), length and line-length limits, alphabetic-ratio check, exact deduplication, and removal of any sample that shares a normalized line (40+ chars, imports excluded) with HumanEval, any MBPP split or BigCodeBench, or contains an MBPP task description (1079 candidate samples removed). The packed data was re-scanned after tokenization as a final check.- Hardware: 2x NVIDIA T4 (DDP, fp16 mixed precision), sequence length 1024, batch 32k tokens, peak LR 2e-05, cosine schedule
## Evaluation
Greedy decoding, pass@1 (%), identical harness for every row (max 200 new tokens for MBPP, 300 for BigCodeBench).MBPP (500 test problems) is zero-shot with the task and the first test in the prompt; the "instruct template" row wraps the same prompt in the training format.BigCodeBench (1140 tasks, version `v0.1.4`): "raw prompt" rows use BigCodeBench-Complete (`complete_prompt`, the model continues the function); the "instruct template" row uses BigCodeBench-Instruct in the training format with the `code_prompt` (imports and signature) pre-filled in the response.This is a lightweight harness (unittest in a subprocess, 30 s timeout, only the libraries preinstalled on Kaggle, prompts longer than the 1024-token context count as failed), so BigCodeBench numbers are lower than the official leaderboard's and not comparable with it.
| Model | Params | MBPP | BigCodeBench ||---|---|---|---|| Kuantum-ai1/TinyCode1.1-164M-Python-Instruct (raw prompt) | 164M | 12.6 | 0.0 || Kuantum-ai1/TinyCode1.1-164M-Python-Instruct (instruct template) | 164M | 12.0 | 0.0 || Kuantum-ai1/TinyCode1.1-164M-Python (previous) | 164M | 9.8 | 0.0 || Base: bigcode/tiny_starcoder_py | 164M | 4.8 | - |
Instruct (template) vs the previous version: MBPP +2.20 (absolute pass@1 points).
The base row's MBPP number comes from an earlier run of the same harness; BigCodeBench was not measured for it.
## GGUF
- `TinyCode1.1-164M-Python-Instruct-Q4_0.gguf` (126 MB)- `TinyCode1.1-164M-Python-Instruct-Q4_K_M.gguf` (134 MB)- `TinyCode1.1-164M-Python-Instruct-Q4_K_S.gguf` (127 MB)- `TinyCode1.1-164M-Python-Instruct-Q5_K_M.gguf` (145 MB)- `TinyCode1.1-164M-Python-Instruct-Q6_K.gguf` (157 MB)- `TinyCode1.1-164M-Python-Instruct-Q8_0.gguf` (195 MB)
## Usage
```pythonfrom transformers import AutoModelForCausalLM, AutoTokenizertok = AutoTokenizer.from_pretrained("Kuantum-ai1/TinyCode1.1-164M-Python-Instruct")model = AutoModelForCausalLM.from_pretrained("Kuantum-ai1/TinyCode1.1-164M-Python-Instruct")msgs = [{"role": "user", "content": "Write a function that returns the n-th Fibonacci number."}]prompt = tok.apply_chat_template(msgs, tokenize=False) + "```python\n"ids = tok(prompt, return_tensors="pt")out = model.generate(**ids, max_new_tokens=200, do_sample=False)print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True).split("\n```")[0])```
## Limitations
Small model: it makes frequent mistakes and should not be relied on for production code. It only answers with Python code (no explanations) and has a 1024-token context. Generated code must be reviewed before use.
## License
bigcode-openrail-m123version https://git-lfs.github.com/spec/v1oid sha256:93fbd25f846b4ab12e57e62f73c7b146514b0a4b8313f4e609bd52b5b1d165e3size 126018144123version https://git-lfs.github.com/spec/v1oid sha256:7fb5002bb247cf7e2e50e6a7e8b4a3b5da311c2e595fb3df31a6849c0957632bsize 133874784123version https://git-lfs.github.com/spec/v1oid sha256:f0d3ab7ee1157aac2219c805a7f989cbfa3c54727158c78139fdf2b24bcf8498size 126952032123version https://git-lfs.github.com/spec/v1oid sha256:f30c7d94e686e7f9e07a74206e7584b3f477af3a41c2360616be746d339d1b53size 145056864123version https://git-lfs.github.com/spec/v1oid sha256:4a8903e049c42496871a7e818a042d01d76014ecfe4da14440a46837427c7b8esize 156937824123version https://git-lfs.github.com/spec/v1oid sha256:9401a9b6ba4b1656a53c1ab5b8848b55ff5953fe68682dd51c09b27eebda3613size 19512585612345{% for m in messages %}{% if m['role'] == 'user' %}### Instruction:{{ m['content'] }}
### Response:{% elif m['role'] == 'assistant' %}{{ m['content'] }}{{ eos_token }}{% endif %}{% endfor %}123456789101112131415161718192021222324252627282930313233343536373839404142{ "activation_function": "gelu_pytorch_tanh", "add_cross_attention": false, "architectures": [ "GPTBigCodeForCausalLM" ], "attention_softmax_in_fp32": true, "attn_pdrop": 0.1, "bos_token_id": 0, "dtype": "float32", "embd_pdrop": 0.1, "eos_token_id": 0, "inference_runner": 0, "initializer_range": 0.02, "layer_norm_epsilon": 1e-05, "max_batch_size": null, "max_sequence_length": null, "model_type": "gpt_bigcode", "multi_query": true, "n_embd": 768, "n_head": 12, "n_inner": 3072, "n_layer": 20, "n_positions": 8192, "num_key_value_heads": 1, "pad_key_length": true, "pad_token_id": null, "pre_allocate_kv_cache": false, "resid_pdrop": 0.1, "scale_attention_softmax_in_fp32": true, "scale_attn_weights": true, "summary_activation": null, "summary_first_dropout": 0.1, "summary_proj_to_labels": true, "summary_type": "cls_index", "summary_use_proj": true, "tie_word_embeddings": true, "transformers_version": "5.20.2", "use_cache": true, "validate_runner_input": true, "vocab_size": 49152}123456{ "_from_model_config": true, "bos_token_id": 0, "eos_token_id": 0, "transformers_version": "5.20.2"}123version https://git-lfs.github.com/spec/v1oid sha256:4065206cf0a86f331b7a4c11593e11a39e725eb84fe40651f6604c77ef8f7f16size 656601304123456789101112131415161718192021222324252627282930313233{ "add_prefix_space": false, "backend": "tokenizers", "bos_token": "<|endoftext|>", "eos_token": "<|endoftext|>", "extra_special_tokens": [ "<|endoftext|>", "<fim_prefix>", "<fim_middle>", "<fim_suffix>", "<fim_pad>", "<filename>", "<gh_stars>", "<issue_start>", "<issue_comment>", "<issue_closed>", "<jupyter_start>", "<jupyter_text>", "<jupyter_code>", "<jupyter_output>", "<empty_output>", "<commit_before>", "<commit_msg>", "<commit_after>", "<reponame>" ], "is_local": false, "local_files_only": false, "model_max_length": 1000000000000000019884624838656, "tokenizer_class": "TokenizersBackend", "unk_token": "<|endoftext|>", "vocab_size": 49152}.gitattributes+6
README.mdAdded+83
TinyCode1.1-164M-Python-Instruct-Q4_0.ggufAdded+3
TinyCode1.1-164M-Python-Instruct-Q4_K_M.ggufAdded+3
TinyCode1.1-164M-Python-Instruct-Q4_K_S.ggufAdded+3
TinyCode1.1-164M-Python-Instruct-Q5_K_M.ggufAdded+3
TinyCode1.1-164M-Python-Instruct-Q6_K.ggufAdded+3
TinyCode1.1-164M-Python-Instruct-Q8_0.ggufAdded+3
chat_template.jinjaAdded+5
config.jsonAdded+42
generation_config.jsonAdded+6
model.safetensorsAdded+3
tokenizer.jsonAdded
tokenizer_config.jsonAdded+33