pranav-pvnn commited on
Commit
980f806
Β·
verified Β·
1 Parent(s): c43556c

Initial model upload

Browse files

First commit: LoRA adapter weights and tokenizer files

README.md CHANGED
@@ -1,3 +1,75 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ base_model: codellama/CodeLlama-7b-hf
6
+ tags:
7
+ - code
8
+ - python
9
+ - codellama
10
+ - qlora
11
+ - unsloth
12
+ datasets:
13
+ - custom
14
+ pipeline_tag: text-generation
15
+ ---
16
+
17
+ # CodeLlama 7B Python AI Assistant (QLoRA)
18
+
19
+ Fine-tuned CodeLlama-7B model specialized for Python programming assistance using QLoRA (Quantized Low-Rank Adaptation).
20
+
21
+ ## Model Description
22
+
23
+ - **Base Model:** [codellama/CodeLlama-7b-hf](https://huggingface.co/codellama/CodeLlama-7b-hf)
24
+ - **Fine-tuning Method:** QLoRA (4-bit quantization with LoRA adapters)
25
+ - **Framework:** Unsloth + Transformers
26
+ - **Training Data:** Custom Python programming examples
27
+
28
+ ## Usage
29
+
30
+ This repository contains **LoRA adapters only**. To use, merge the adapters with the base model.
31
+
32
+ from unsloth import FastLanguageModel
33
+
34
+ model, tokenizer = FastLanguageModel.from_pretrained(
35
+ model_name="pranav-pvnn/codellama-7b-python-ai-assistant",
36
+ max_seq_length=2048,
37
+ load_in_4bit=True,
38
+ )
39
+
40
+ prompt = "### Instruction:\nWrite a Python function to calculate factorial.\n### Response:\n"
41
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
42
+ outputs = model.generate(**inputs, max_new_tokens=256)
43
+ print(tokenizer.decode(outputs, skip_special_tokens=True))
44
+
45
+ ## Training Details
46
+
47
+ - **Quantization:** 4-bit
48
+ - **LoRA Rank:** 64
49
+ - **Learning Rate:** 2e-4
50
+ - **Epochs:** 4
51
+ - **Max Seq Length:** 2048
52
+ - **GPU:** NVIDIA Tesla T4
53
+
54
+ ## Limitations
55
+
56
+ - Requires base model for inference.
57
+ - Optimized for Python code generation.
58
+ - Trained on custom dataset (~2,000 examples).
59
+
60
+ ## Citation
61
+
62
+ @misc{codellama-7b-python-assistant,
63
+ author = {pranav-pvnn},
64
+ title = {CodeLlama 7B Python AI Assistant},
65
+ year = {2025},
66
+ publisher = {HuggingFace},
67
+ howpublished = {\url{https://huggingface.co/pranav-pvnn/codellama-7b-python-ai-assistant}}
68
+ }
69
+
70
+ ## Acknowledgements
71
+
72
+ - Base Model: [Meta's CodeLlama](https://huggingface.co/codellama/CodeLlama-7b-hf)
73
+ - Training Framework: [Unsloth](https://github.com/unslothai/unsloth)
74
+ - Quantization: [bitsandbytes](https://github.com/TimDettmers/bitsandbytes)
75
+ - LoRA: [PEFT](https://github.com/huggingface/peft)
adapter_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "unsloth/codellama-7b-bnb-4bit",
5
+ "bias": "none",
6
+ "corda_config": null,
7
+ "eva_config": null,
8
+ "exclude_modules": null,
9
+ "fan_in_fan_out": false,
10
+ "inference_mode": true,
11
+ "init_lora_weights": true,
12
+ "layer_replication": null,
13
+ "layers_pattern": null,
14
+ "layers_to_transform": null,
15
+ "loftq_config": {},
16
+ "lora_alpha": 16,
17
+ "lora_bias": false,
18
+ "lora_dropout": 0.1,
19
+ "megatron_config": null,
20
+ "megatron_core": "megatron.core",
21
+ "modules_to_save": null,
22
+ "peft_type": "LORA",
23
+ "qalora_group_size": 16,
24
+ "r": 64,
25
+ "rank_pattern": {},
26
+ "revision": null,
27
+ "target_modules": [
28
+ "k_proj",
29
+ "o_proj",
30
+ "up_proj",
31
+ "down_proj",
32
+ "v_proj",
33
+ "lm_head",
34
+ "q_proj",
35
+ "gate_proj"
36
+ ],
37
+ "target_parameters": null,
38
+ "task_type": "CAUSAL_LM",
39
+ "trainable_token_indices": null,
40
+ "use_dora": false,
41
+ "use_qalora": false,
42
+ "use_rslora": false
43
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1cea4e6f1fb7c2320b0eabac53fa0c84adcab7b43e81ee92162334bc441b72f5
3
+ size 1173487432
special_tokens_map.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "▁<PRE>",
4
+ "▁<MID>",
5
+ "▁<SUF>",
6
+ "▁<EOT>",
7
+ "▁<PRE>",
8
+ "▁<MID>",
9
+ "▁<SUF>",
10
+ "▁<EOT>"
11
+ ],
12
+ "bos_token": {
13
+ "content": "<s>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false
18
+ },
19
+ "eos_token": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false
25
+ },
26
+ "pad_token": {
27
+ "content": "<unk>",
28
+ "lstrip": false,
29
+ "normalized": false,
30
+ "rstrip": false,
31
+ "single_word": false
32
+ },
33
+ "unk_token": {
34
+ "content": "<unk>",
35
+ "lstrip": false,
36
+ "normalized": false,
37
+ "rstrip": false,
38
+ "single_word": false
39
+ }
40
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45ccb9c8b6b561889acea59191d66986d314e7cbd6a78abc6e49b139ca91c1e6
3
+ size 500058
tokenizer_config.json ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "32007": {
30
+ "content": "▁<PRE>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "32008": {
38
+ "content": "▁<SUF>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "32009": {
46
+ "content": "▁<MID>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "32010": {
54
+ "content": "▁<EOT>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ }
61
+ },
62
+ "additional_special_tokens": [
63
+ "▁<PRE>",
64
+ "▁<MID>",
65
+ "▁<SUF>",
66
+ "▁<EOT>",
67
+ "▁<PRE>",
68
+ "▁<MID>",
69
+ "▁<SUF>",
70
+ "▁<EOT>"
71
+ ],
72
+ "bos_token": "<s>",
73
+ "clean_up_tokenization_spaces": false,
74
+ "eos_token": "</s>",
75
+ "eot_token": "▁<EOT>",
76
+ "extra_special_tokens": {},
77
+ "fill_token": "<FILL_ME>",
78
+ "legacy": null,
79
+ "middle_token": "▁<MID>",
80
+ "model_max_length": 16384,
81
+ "pad_token": "<unk>",
82
+ "padding_side": "left",
83
+ "prefix_token": "▁<PRE>",
84
+ "sp_model_kwargs": {},
85
+ "suffix_token": "▁<SUF>",
86
+ "tokenizer_class": "CodeLlamaTokenizer",
87
+ "unk_token": "<unk>",
88
+ "use_default_system_prompt": false
89
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:20af52d7015032a985f82985586bbd1becf6523f3f285d9d03ffe5862265b006
3
+ size 5905