Irfanuruchi commited on
Commit
3812594
·
verified ·
1 Parent(s): cdd03fb

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +110 -0
README.md ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama2
3
+ base_model: meta-llama/Llama-2-13b-hf
4
+ tags:
5
+ - llama2
6
+ - computer-engineering
7
+ - computer-architecture
8
+ - algorithms
9
+ - systems
10
+ - qora
11
+ - lora
12
+ - quantized
13
+ - merged
14
+ language:
15
+ - en
16
+ pipeline_tag: text-generation
17
+ library_name: transformers
18
+ datasets:
19
+ - cais/mmlu
20
+ - sahil2801/CodeAlpaca-20k
21
+ - Open-Orca/OpenOrca
22
+ model_type: llama
23
+ ---
24
+
25
+ # Llama-2-13B-Computer-Engineering
26
+
27
+ ### Overview
28
+
29
+ **Llama-2-13B-Computer-Engineering** is a fine‑tuned variant of **LLaMA‑2‑13B**, adapted for **computer engineering, computer architecture, systems, and algorithms**.
30
+ The model was trained using **QLoRA (4‑bit quantization)**, then merged into a single checkpoint.
31
+ This allows **13B‑scale reasoning** to run in ~6.6 GB of storage and ~16GB of GPU memory, making it usable on a single modern GPU.
32
+
33
+ ---
34
+
35
+ ### Training Setup
36
+ - **Base model:** [LLaMA‑2‑13B](https://huggingface.co/meta-llama/Llama-2-13b-hf)
37
+ - **Fine‑tuning method:** QLoRA (4‑bit NF4) + LoRA adapters (`r=16`, `α=32`)
38
+ - **Optimized Layers:** Attention projection modules (`q_proj`, `k_proj`, `v_proj`, `o_proj`)
39
+ - **Final merge:** LoRA weights merged into the base model → single merged checkpoint
40
+ - **Resulting size:** ~6.6 GB (`safetensors` sharded files) vs. ~24 GB fp16
41
+
42
+ ---
43
+
44
+ ## Dataset
45
+ The dataset was curated from multiple sources to emphasize **reasoning, explanations, and code writing in computer engineering contexts**.
46
+
47
+ Included sources:
48
+ - **MMLU (Computer Security subset)** → exam‑style questions on systems and security
49
+ - **CodeAlpaca‑20k (filtered)** → algorithm, data structures, complexity, trees, sorting/searching, graphs
50
+ - **OpenOrca subset** → reasoning tasks mentioning computer systems and architecture
51
+ - **Custom technical examples** (hand‑crafted) on:
52
+ - CPU pipelining & instruction‑level parallelism
53
+ - Cache coherency and MESI protocol
54
+ - Compiler optimizations (instruction scheduling, inlining, loop unrolling)
55
+ - RISC vs. CISC architectures
56
+ - Memory hierarchies (registers, caches, RAM, storage)
57
+ - Branch prediction
58
+ - Example algorithms (binary search, stacks, etc.)
59
+
60
+
61
+ ---
62
+
63
+ ### Usage
64
+
65
+
66
+ ```python
67
+ from transformers import AutoModelForCausalLM, AutoTokenizer
68
+
69
+ model = AutoModelForCausalLM.from_pretrained(
70
+ "Irfanuruchi/Llama-2-13B-Computer-Engineering",
71
+ torch_dtype="auto",
72
+ device_map="auto"
73
+ )
74
+ tokenizer = AutoTokenizer.from_pretrained("Irfanuruchi/Llama-2-13B-Computer-Engineering")
75
+
76
+ prompt = """### Instruction:
77
+ Explain CPU pipelining and its advantages.
78
+
79
+ ### Response:"""
80
+
81
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
82
+ outputs = model.generate(**inputs, max_new_tokens=256)
83
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
84
+
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Example Responses
90
+
91
+ Q: What is cache coherency in multicore systems?
92
+ A: Cache coherence ensures that all processor cores observe a consistent view of memory. Protocols such as MESI handle invalidation and updates when one core modifies data, preventing stale values and race conditions.
93
+
94
+ Q: Implement a stack in Python.
95
+ A: Produces a Stack class with methods for push, pop, peek, is_empty, and size.
96
+
97
+ ---
98
+
99
+
100
+ ## Limitations
101
+
102
+ - While optimized for computer engineering, performance outside this scope is similar to the base LLaMA‑2‑13B.
103
+
104
+ ---
105
+
106
+ ## License
107
+
108
+ - Base model:[Meta's LLaMA 2 license](https://huggingface.co/meta-llama/Llama-2-13b-hf).
109
+ - Fine‑tuned weights: Distributed under the same license.
110
+ - Datasets: Combination of open academic sets (MMLU, CodeAlpaca, OpenOrca) and custom educational material.