Upload folder using huggingface_hub
Browse files- README.md +37 -0
- config.json +41 -0
- generation_config.json +9 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +20 -0
README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# GPT-2.5-Code
|
| 3 |
+
|
| 4 |
+
GPT-2.5-Code is a 0.5B parameter causal language model specialized for Python coding tasks. It was created by fine-tuning the [BikoRiko/GPT-2.5-Math](https://huggingface.co/BikoRiko/GPT-2.5-Math) base model.
|
| 5 |
+
|
| 6 |
+
## Model Details
|
| 7 |
+
- **Developed by:** BikoRiko
|
| 8 |
+
- **Model type:** GPT-2 architecture
|
| 9 |
+
- **Language(s):** Python, English
|
| 10 |
+
- **License:** MIT
|
| 11 |
+
- **Fine-tuned from model:** BikoRiko/GPT-2.5-Math
|
| 12 |
+
|
| 13 |
+
## Training Procedure
|
| 14 |
+
- **Infrastructure:** NVIDIA H100 GPU via Modal.com
|
| 15 |
+
- **Dataset:** `flytech/python-codes-25k` (Specialized subset)
|
| 16 |
+
- **Epochs:** 5
|
| 17 |
+
- **Learning Rate:** 1e-4 (Cosine schedule)
|
| 18 |
+
- **Batch Size:** 4 with Gradient Accumulation (4 steps)
|
| 19 |
+
|
| 20 |
+
## Intended Use
|
| 21 |
+
This model is designed for short-form Python code generation and completion tasks. It has been transitioned from a mathematical reasoning focus to a structured programming focus.
|
| 22 |
+
|
| 23 |
+
## How to use
|
| 24 |
+
```python
|
| 25 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 26 |
+
|
| 27 |
+
tokenizer = AutoTokenizer.from_pretrained("BikoRiko/GPT-2.5-Code")
|
| 28 |
+
model = AutoModelForCausalLM.from_pretrained("BikoRiko/GPT-2.5-Code")
|
| 29 |
+
|
| 30 |
+
instruction = "Write a python function to calculate the area of a circle."
|
| 31 |
+
prompt = f"Instruction: {instruction}
|
| 32 |
+
Output:"
|
| 33 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 34 |
+
|
| 35 |
+
outputs = model.generate(**inputs, max_new_tokens=128)
|
| 36 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 37 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_function": "gelu_new",
|
| 3 |
+
"add_cross_attention": false,
|
| 4 |
+
"architectures": [
|
| 5 |
+
"GPT2LMHeadModel"
|
| 6 |
+
],
|
| 7 |
+
"attn_pdrop": 0.1,
|
| 8 |
+
"bos_token_id": 50256,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"embd_pdrop": 0.1,
|
| 11 |
+
"eos_token_id": 50256,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"layer_norm_epsilon": 1e-05,
|
| 14 |
+
"model_type": "gpt2",
|
| 15 |
+
"n_ctx": 2048,
|
| 16 |
+
"n_embd": 768,
|
| 17 |
+
"n_head": 12,
|
| 18 |
+
"n_inner": null,
|
| 19 |
+
"n_layer": 18,
|
| 20 |
+
"n_positions": 2048,
|
| 21 |
+
"pad_token_id": null,
|
| 22 |
+
"reorder_and_upcast_attn": false,
|
| 23 |
+
"resid_pdrop": 0.1,
|
| 24 |
+
"scale_attn_by_inverse_layer_idx": false,
|
| 25 |
+
"scale_attn_weights": true,
|
| 26 |
+
"summary_activation": null,
|
| 27 |
+
"summary_first_dropout": 0.1,
|
| 28 |
+
"summary_proj_to_labels": true,
|
| 29 |
+
"summary_type": "cls_index",
|
| 30 |
+
"summary_use_proj": true,
|
| 31 |
+
"task_specific_params": {
|
| 32 |
+
"text-generation": {
|
| 33 |
+
"do_sample": true,
|
| 34 |
+
"max_length": 50
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
"tie_word_embeddings": true,
|
| 38 |
+
"transformers_version": "5.8.1",
|
| 39 |
+
"use_cache": false,
|
| 40 |
+
"vocab_size": 50257
|
| 41 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 50256,
|
| 4 |
+
"eos_token_id": 50256,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"transformers_version": "5.8.1",
|
| 8 |
+
"use_cache": false
|
| 9 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:99535411af61a0e1fbaae734560a3cfdc3ff609e7574459159c82828edf1688c
|
| 3 |
+
size 671036264
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<|endoftext|>",
|
| 5 |
+
"eos_token": "<|endoftext|>",
|
| 6 |
+
"errors": "replace",
|
| 7 |
+
"is_local": false,
|
| 8 |
+
"local_files_only": false,
|
| 9 |
+
"max_length": 128,
|
| 10 |
+
"model_max_length": 1024,
|
| 11 |
+
"pad_to_multiple_of": null,
|
| 12 |
+
"pad_token": "<|endoftext|>",
|
| 13 |
+
"pad_token_type_id": 0,
|
| 14 |
+
"padding_side": "right",
|
| 15 |
+
"stride": 0,
|
| 16 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 17 |
+
"truncation_side": "right",
|
| 18 |
+
"truncation_strategy": "longest_first",
|
| 19 |
+
"unk_token": "<|endoftext|>"
|
| 20 |
+
}
|