Instructions to use Kuantum-ai1/TinyCode1.1-164M-Python 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 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")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Kuantum-ai1/TinyCode1.1-164M-Python") model = AutoModelForCausalLM.from_pretrained("Kuantum-ai1/TinyCode1.1-164M-Python", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Kuantum-ai1/TinyCode1.1-164M-Python 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" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kuantum-ai1/TinyCode1.1-164M-Python", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Kuantum-ai1/TinyCode1.1-164M-Python
- SGLang
How to use Kuantum-ai1/TinyCode1.1-164M-Python 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" \ --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": "Kuantum-ai1/TinyCode1.1-164M-Python", "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 "Kuantum-ai1/TinyCode1.1-164M-Python" \ --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": "Kuantum-ai1/TinyCode1.1-164M-Python", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Kuantum-ai1/TinyCode1.1-164M-Python with Docker Model Runner:
docker model run hf.co/Kuantum-ai1/TinyCode1.1-164M-Python
Upload folder using huggingface_hub
Browse files- README.md +59 -0
- config.json +42 -0
- generation_config.json +6 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +33 -0
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: bigcode-openrail-m
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
base_model: Kuantum-ai1/TinyCode1-164M-Python
|
| 8 |
+
tags:
|
| 9 |
+
- code
|
| 10 |
+
- python
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# TinyCode1.1-164M-Python
|
| 14 |
+
|
| 15 |
+
A small Python code-completion model, fine-tuned from [`Kuantum-ai1/TinyCode1-164M-Python`](https://huggingface.co/Kuantum-ai1/TinyCode1-164M-Python) (v1, itself fine-tuned from [`bigcode/tiny_starcoder_py`](https://huggingface.co/bigcode/tiny_starcoder_py)) on 80M tokens of filtered Python code.
|
| 16 |
+
|
| 17 |
+
## Training
|
| 18 |
+
|
| 19 |
+
- Base model: `Kuantum-ai1/TinyCode1-164M-Python` (v1)
|
| 20 |
+
- Data (80M tokens, single pass): about 10M tokens of instruction-style docstring-to-code pairs (Magicoder-OSS-Instruct, self-oss-instruct-sc2) and the rest from [`jon-tow/starcoderdata-python-edu`](https://huggingface.co/datasets/jon-tow/starcoderdata-python-edu) (educational-quality Python files).
|
| 21 |
+
- 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) with HumanEval (prompt, solution, tests) or any MBPP split, or contains an MBPP task description (14 candidate samples removed). The packed data was re-scanned after tokenization as a final check.
|
| 22 |
+
- Hardware: 2x NVIDIA T4 (DDP, fp16 mixed precision), sequence length 1024, batch 65k tokens, peak LR 5e-05, cosine schedule
|
| 23 |
+
|
| 24 |
+
## Evaluation
|
| 25 |
+
|
| 26 |
+
Greedy decoding, pass@1 (%), identical harness for every model (max 200 new tokens, 10 s timeout per program).
|
| 27 |
+
HumanEval uses the standard prompts; MBPP (500 test problems) is zero-shot with a docstring-style prompt containing the task and the first test, so numbers are not directly comparable with few-shot figures reported elsewhere.
|
| 28 |
+
|
| 29 |
+
| Model | Params | HumanEval | MBPP |
|
| 30 |
+
|---|---|---|---|
|
| 31 |
+
| Base: bigcode/tiny_starcoder_py | 164M | 9.15 | 4.8 |
|
| 32 |
+
| Kuantum-ai1/TinyCode1.1-164M-Python (v1.1, ours) | 164M | 0.0 | 9.8 |
|
| 33 |
+
| Kuantum-ai1/TinyCode1-164M-Python (v1) | 164M | 0.0 | 3.8 |
|
| 34 |
+
|
| 35 |
+
Compared with v1: HumanEval +0.00, MBPP +6.00 (absolute pass@1 points).
|
| 36 |
+
|
| 37 |
+
Base numbers come from an earlier run of the same harness; v1 and v1.1 were evaluated together in the final run.
|
| 38 |
+
|
| 39 |
+
## GGUF
|
| 40 |
+
|
| 41 |
+
Not available.
|
| 42 |
+
|
| 43 |
+
## Usage
|
| 44 |
+
|
| 45 |
+
```python
|
| 46 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 47 |
+
tok = AutoTokenizer.from_pretrained("Kuantum-ai1/TinyCode1.1-164M-Python")
|
| 48 |
+
model = AutoModelForCausalLM.from_pretrained("Kuantum-ai1/TinyCode1.1-164M-Python")
|
| 49 |
+
ids = tok("def fibonacci(n):", return_tensors="pt")
|
| 50 |
+
print(tok.decode(model.generate(**ids, max_new_tokens=100)[0]))
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Limitations
|
| 54 |
+
|
| 55 |
+
Small model: it makes frequent mistakes and should not be relied on for production code. Generated code must be reviewed before use.
|
| 56 |
+
|
| 57 |
+
## License
|
| 58 |
+
|
| 59 |
+
bigcode-openrail-m
|
config.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_function": "gelu_pytorch_tanh",
|
| 3 |
+
"add_cross_attention": false,
|
| 4 |
+
"architectures": [
|
| 5 |
+
"GPTBigCodeForCausalLM"
|
| 6 |
+
],
|
| 7 |
+
"attention_softmax_in_fp32": true,
|
| 8 |
+
"attn_pdrop": 0.1,
|
| 9 |
+
"bos_token_id": 0,
|
| 10 |
+
"dtype": "float32",
|
| 11 |
+
"embd_pdrop": 0.1,
|
| 12 |
+
"eos_token_id": 0,
|
| 13 |
+
"inference_runner": 0,
|
| 14 |
+
"initializer_range": 0.02,
|
| 15 |
+
"layer_norm_epsilon": 1e-05,
|
| 16 |
+
"max_batch_size": null,
|
| 17 |
+
"max_sequence_length": null,
|
| 18 |
+
"model_type": "gpt_bigcode",
|
| 19 |
+
"multi_query": true,
|
| 20 |
+
"n_embd": 768,
|
| 21 |
+
"n_head": 12,
|
| 22 |
+
"n_inner": 3072,
|
| 23 |
+
"n_layer": 20,
|
| 24 |
+
"n_positions": 8192,
|
| 25 |
+
"num_key_value_heads": 1,
|
| 26 |
+
"pad_key_length": true,
|
| 27 |
+
"pad_token_id": null,
|
| 28 |
+
"pre_allocate_kv_cache": false,
|
| 29 |
+
"resid_pdrop": 0.1,
|
| 30 |
+
"scale_attention_softmax_in_fp32": true,
|
| 31 |
+
"scale_attn_weights": true,
|
| 32 |
+
"summary_activation": null,
|
| 33 |
+
"summary_first_dropout": 0.1,
|
| 34 |
+
"summary_proj_to_labels": true,
|
| 35 |
+
"summary_type": "cls_index",
|
| 36 |
+
"summary_use_proj": true,
|
| 37 |
+
"tie_word_embeddings": true,
|
| 38 |
+
"transformers_version": "5.20.2",
|
| 39 |
+
"use_cache": false,
|
| 40 |
+
"validate_runner_input": true,
|
| 41 |
+
"vocab_size": 49152
|
| 42 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 0,
|
| 4 |
+
"eos_token_id": 0,
|
| 5 |
+
"transformers_version": "5.20.2"
|
| 6 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e9ec7a6fbaec27e4728f9f8df5643cdde17486c497603d7721c51bdc9f5fa291
|
| 3 |
+
size 656601304
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<|endoftext|>",
|
| 5 |
+
"eos_token": "<|endoftext|>",
|
| 6 |
+
"extra_special_tokens": [
|
| 7 |
+
"<|endoftext|>",
|
| 8 |
+
"<fim_prefix>",
|
| 9 |
+
"<fim_middle>",
|
| 10 |
+
"<fim_suffix>",
|
| 11 |
+
"<fim_pad>",
|
| 12 |
+
"<filename>",
|
| 13 |
+
"<gh_stars>",
|
| 14 |
+
"<issue_start>",
|
| 15 |
+
"<issue_comment>",
|
| 16 |
+
"<issue_closed>",
|
| 17 |
+
"<jupyter_start>",
|
| 18 |
+
"<jupyter_text>",
|
| 19 |
+
"<jupyter_code>",
|
| 20 |
+
"<jupyter_output>",
|
| 21 |
+
"<empty_output>",
|
| 22 |
+
"<commit_before>",
|
| 23 |
+
"<commit_msg>",
|
| 24 |
+
"<commit_after>",
|
| 25 |
+
"<reponame>"
|
| 26 |
+
],
|
| 27 |
+
"is_local": false,
|
| 28 |
+
"local_files_only": false,
|
| 29 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 30 |
+
"tokenizer_class": "TokenizersBackend",
|
| 31 |
+
"unk_token": "<|endoftext|>",
|
| 32 |
+
"vocab_size": 49152
|
| 33 |
+
}
|