Kuantum-ai1 commited on
Commit
06a41d8
·
verified ·
1 Parent(s): dc1b4c8

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ TinyCode1.1-164M-Python-Instruct-Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
37
+ TinyCode1.1-164M-Python-Instruct-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
38
+ TinyCode1.1-164M-Python-Instruct-Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
39
+ TinyCode1.1-164M-Python-Instruct-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
40
+ TinyCode1.1-164M-Python-Instruct-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
41
+ TinyCode1.1-164M-Python-Instruct-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.1-164M-Python
8
+ tags:
9
+ - code
10
+ - python
11
+ - instruct
12
+ ---
13
+
14
+ # TinyCode1.1-164M-Python-Instruct
15
+
16
+ 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.
17
+
18
+ ## Prompt format
19
+
20
+ ```
21
+ ### Instruction:
22
+ {your request}
23
+
24
+ ### Response:
25
+ ```python
26
+ ```
27
+
28
+ 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.
29
+
30
+ ## Training
31
+
32
+ - Base model: `Kuantum-ai1/TinyCode1.1-164M-Python`
33
+ - 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.
34
+ - 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.
35
+ - Hardware: 2x NVIDIA T4 (DDP, fp16 mixed precision), sequence length 1024, batch 32k tokens, peak LR 2e-05, cosine schedule
36
+
37
+ ## Evaluation
38
+
39
+ Greedy decoding, pass@1 (%), identical harness for every row (max 200 new tokens for MBPP, 300 for BigCodeBench).
40
+ 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.
41
+ 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.
42
+ 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.
43
+
44
+ | Model | Params | MBPP | BigCodeBench |
45
+ |---|---|---|---|
46
+ | Kuantum-ai1/TinyCode1.1-164M-Python-Instruct (raw prompt) | 164M | 12.6 | 0.0 |
47
+ | Kuantum-ai1/TinyCode1.1-164M-Python-Instruct (instruct template) | 164M | 12.0 | 0.0 |
48
+ | Kuantum-ai1/TinyCode1.1-164M-Python (previous) | 164M | 9.8 | 0.0 |
49
+ | Base: bigcode/tiny_starcoder_py | 164M | 4.8 | - |
50
+
51
+ Instruct (template) vs the previous version: MBPP +2.20 (absolute pass@1 points).
52
+
53
+ The base row's MBPP number comes from an earlier run of the same harness; BigCodeBench was not measured for it.
54
+
55
+ ## GGUF
56
+
57
+ - `TinyCode1.1-164M-Python-Instruct-Q4_0.gguf` (126 MB)
58
+ - `TinyCode1.1-164M-Python-Instruct-Q4_K_M.gguf` (134 MB)
59
+ - `TinyCode1.1-164M-Python-Instruct-Q4_K_S.gguf` (127 MB)
60
+ - `TinyCode1.1-164M-Python-Instruct-Q5_K_M.gguf` (145 MB)
61
+ - `TinyCode1.1-164M-Python-Instruct-Q6_K.gguf` (157 MB)
62
+ - `TinyCode1.1-164M-Python-Instruct-Q8_0.gguf` (195 MB)
63
+
64
+ ## Usage
65
+
66
+ ```python
67
+ from transformers import AutoModelForCausalLM, AutoTokenizer
68
+ tok = AutoTokenizer.from_pretrained("Kuantum-ai1/TinyCode1.1-164M-Python-Instruct")
69
+ model = AutoModelForCausalLM.from_pretrained("Kuantum-ai1/TinyCode1.1-164M-Python-Instruct")
70
+ msgs = [{"role": "user", "content": "Write a function that returns the n-th Fibonacci number."}]
71
+ prompt = tok.apply_chat_template(msgs, tokenize=False) + "```python\n"
72
+ ids = tok(prompt, return_tensors="pt")
73
+ out = model.generate(**ids, max_new_tokens=200, do_sample=False)
74
+ print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True).split("\n```")[0])
75
+ ```
76
+
77
+ ## Limitations
78
+
79
+ 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.
80
+
81
+ ## License
82
+
83
+ bigcode-openrail-m
TinyCode1.1-164M-Python-Instruct-Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:93fbd25f846b4ab12e57e62f73c7b146514b0a4b8313f4e609bd52b5b1d165e3
3
+ size 126018144
TinyCode1.1-164M-Python-Instruct-Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7fb5002bb247cf7e2e50e6a7e8b4a3b5da311c2e595fb3df31a6849c0957632b
3
+ size 133874784
TinyCode1.1-164M-Python-Instruct-Q4_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0d3ab7ee1157aac2219c805a7f989cbfa3c54727158c78139fdf2b24bcf8498
3
+ size 126952032
TinyCode1.1-164M-Python-Instruct-Q5_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f30c7d94e686e7f9e07a74206e7584b3f477af3a41c2360616be746d339d1b53
3
+ size 145056864
TinyCode1.1-164M-Python-Instruct-Q6_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a8903e049c42496871a7e818a042d01d76014ecfe4da14440a46837427c7b8e
3
+ size 156937824
TinyCode1.1-164M-Python-Instruct-Q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9401a9b6ba4b1656a53c1ab5b8848b55ff5953fe68682dd51c09b27eebda3613
3
+ size 195125856
chat_template.jinja ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {% for m in messages %}{% if m['role'] == 'user' %}### Instruction:
2
+ {{ m['content'] }}
3
+
4
+ ### Response:
5
+ {% elif m['role'] == 'assistant' %}{{ m['content'] }}{{ eos_token }}{% endif %}{% endfor %}
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": true,
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:4065206cf0a86f331b7a4c11593e11a39e725eb84fe40651f6604c77ef8f7f16
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
+ }