Mac Huang commited on
Commit
43864c1
·
1 Parent(s): 59bfafb

Initial push of CodeLLaMA Linux BugFix model with Hugging Face LFS support

Browse files
.gitattributes CHANGED
@@ -33,3 +33,6 @@ 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
+ *.json filter=lfs diff=lfs merge=lfs -text
37
+ *.jsonl filter=lfs diff=lfs merge=lfs -text
38
+ *.csv filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- license: apache-2.0
3
- ---
 
1
+ # Linux Kernel Anti-Pattern Detector
2
+
3
+ A comprehensive tool for detecting anti-patterns and potential issues in Linux kernel code.
4
+
5
+ ## 🎯 Overview
6
+
7
+ This project provides automated static analysis tools to identify common anti-patterns, code smells, and potential issues in Linux kernel source code. The analysis covers 7 major categories including memory management, concurrency, security vulnerabilities, and code quality issues.
8
+
9
+ ## 📊 Recent Analysis Results
10
+
11
+ **Analysis Date:** June 29, 2025
12
+ **Kernel Version:** Linux 6.16-rc4
13
+ **Files Analyzed:** 35,588
14
+ **Total Issues Found:** 3,122
15
+
16
+ ### Issue Distribution
17
+ - **🔴 Critical Security Issues:** 347 (11.1%)
18
+ - **🟡 High Priority Issues:** 2,670 (85.5%)
19
+ - **🔵 Medium Priority Issues:** 105 (3.4%)
20
+
21
+ ### Top Categories
22
+ 1. **Concurrency Issues:** 2,314 (74.1%) - Race conditions, deadlocks
23
+ 2. **Memory Management:** 356 (11.4%) - Memory leaks, use-after-free
24
+ 3. **Security Vulnerabilities:** 347 (11.1%) - Buffer overflows, format strings
25
+ 4. **Code Quality:** 92 (2.9%) - Magic numbers, code duplication
26
+
27
+ ## 🚀 Quick Start
28
+
29
+ ### Prerequisites
30
+ - Python 3.8+
31
+ - Git
32
+ - Conda (recommended for environment management)
33
+
34
+ ### Setup
35
+ ```bash
36
+ # Clone the repository
37
+ git clone https://github.com/Mac-Huang/linux-kernel-anti-pattern-detector.git
38
+ cd linux-kernel-anti-pattern-detector
39
+
40
+ # Create and activate conda environment
41
+ conda create -n linux-kernel-anti-pattern-detector python=3.10 -y
42
+ conda activate linux-kernel-anti-pattern-detector
43
+
44
+ # Install dependencies
45
+ pip install -r requirements.txt
46
+ pip install -r requirements-kernel-analysis.txt
47
+ ```
48
+
49
+ ### Run Analysis
50
+ ```bash
51
+ # Full kernel analysis (clones kernel if needed)
52
+ python tools/detectors/detector.py --clone --output data/results.json
53
+
54
+ # Concurrency-specific analysis
55
+ python scripts/analysis/concurrency_analyzer.py
56
+
57
+ # View results interactively
58
+ python scripts/reporting/view_results.py --interactive
59
+ ```
60
+
61
+ ## 🗃️ Dataset Building Pipeline
62
+
63
+ ### ✅ **Successfully Implemented**
64
+
65
+ The project includes a robust dataset building pipeline for training code intelligence models on Linux kernel bug fixes.
66
+
67
+ #### **Dataset Format**
68
+ ```json
69
+ {
70
+ "input": {
71
+ "original code": "code before the patch (extracted from a known bug-fix)",
72
+ "instruction": "the commit message describing what this fix is"
73
+ },
74
+ "output": {
75
+ "diff codes": "the unified diff patch for the bug fix"
76
+ }
77
+ }
78
+ ```
79
+
80
+ #### **Features**
81
+ - **🔍 Intelligent Bug Detection:** Uses keyword-based filtering to identify bug-fix commits
82
+ - **📝 Focused Code Extraction:** Extracts relevant code context around bug fixes
83
+ - **🔧 Diff Processing:** Parses and formats unified diff patches
84
+ - **⚡ Parallel Processing:** Multi-threaded processing for large repositories
85
+ - **📊 Quality Filtering:** Only includes valid C source file modifications
86
+
87
+ #### **Usage**
88
+ ```bash
89
+ # Activate environment
90
+ conda activate detector
91
+
92
+ # Build test dataset (small sample)
93
+ cd dataset_builder
94
+ python build_dataset_demo.py
95
+
96
+ # Build full dataset (entire repository)
97
+ # Edit TEST_MODE = False in build_dataset_demo.py
98
+ python build_dataset_demo.py
99
+ ```
100
+
101
+ #### **Output**
102
+ - **File:** `dataset_builder/output/linux_bugfix_dataset.jsonl`
103
+ - **Format:** JSONL (one JSON object per line)
104
+ - **Content:** Bug-fix commits with original code, commit messages, and diff patches
105
+
106
+ #### **Keywords Detected**
107
+ - Memory issues: `leak`, `null`, `overflow`, `memory`
108
+ - Security: `security`, `vulnerability`, `exploit`, `buffer`
109
+ - Concurrency: `race`, `deadlock`, `lock`
110
+ - General bugs: `fix`, `bug`, `error`, `failure`, `crash`
111
+
112
+ ## 📁 Project Structure
113
+
114
+ ```
115
+ ├── 📁 data/ # Analysis results and logs
116
+ ├── 📁 dataset_builder/ # Dataset building pipeline
117
+ │ ├── build_dataset.py # Main dataset builder
118
+ │ ├── build_dataset_demo.py # Test dataset builder
119
+ │ └── output/ # Generated datasets
120
+ ├── 📁 docs/ # Documentation
121
+ ├── 📁 reports/ # Generated reports
122
+ ├── 📁 scripts/ # Analysis and utility scripts
123
+ ├── 📁 src/ # Core source code
124
+ ├── 📁 tests/ # Test files
125
+ ├── 📁 tools/ # Detection tools
126
+ └── 📁 linux/ # Kernel source (cloned)
127
+ ```
128
+
129
+ See [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md) for detailed structure information.
130
+
131
+ ## 📋 Available Reports
132
+
133
+ ### 📄 Main Reports
134
+ - **[Complete Analysis Report](reports/Linux_Kernel_Anti_Pattern_Analysis_Report.md)** - Full technical analysis
135
+ - **[Executive Summary](reports/Executive_Summary.md)** - High-level overview for stakeholders
136
+
137
+ ### 🔒 Specialized Reports
138
+ - **[Concurrency Analysis](reports/concurrency/Concurrency_Analysis_Report.md)** - Detailed concurrency issues (2,314 issues)
139
+
140
+ ## 🛠️ Usage Examples
141
+
142
+ ### Basic Analysis
143
+ ```bash
144
+ # Run complete analysis
145
+ python tools/detectors/detector.py --clone --output data/results.json
146
+
147
+ # Quick summary
148
+ python scripts/utils/quick_summary.py
149
+
150
+ # Interactive results viewer
151
+ python scripts/reporting/view_results.py --interactive
152
+ ```
153
+
154
+ ### Specialized Analysis
155
+ ```bash
156
+ # Concurrency issues only
157
+ python scripts/analysis/concurrency_analyzer.py
158
+
159
+ # Kernel structure analysis
160
+ python scripts/analysis/analyze_kernel_structure.py
161
+ ```
162
+
163
+ ### Custom Configuration
164
+ ```bash
165
+ # Use custom config
166
+ python tools/detectors/detector.py --config tools/detectors/config.yaml
167
+
168
+ # Analyze specific kernel path
169
+ python tools/detectors/detector.py --kernel-path /path/to/kernel
170
+ ```
171
+
172
+ ## 🔍 Detection Categories
173
+
174
+ ### 1. Memory Management
175
+ - Memory leaks (kmalloc without kfree)
176
+ - Use-after-free bugs
177
+ - Double-free issues
178
+ - Null pointer dereferences
179
+
180
+ ### 2. Concurrency
181
+ - Race conditions
182
+ - Deadlocks
183
+ - Missing locks
184
+ - Double locking
185
+ - Lock ordering violations
186
+
187
+ ### 3. Security
188
+ - Buffer overflows
189
+ - Format string vulnerabilities
190
+ - Privilege escalation
191
+ - Information disclosure
192
+
193
+ ### 4. Error Handling
194
+ - Unchecked return values
195
+ - Missing error handling
196
+ - Ignored error codes
197
+ - Wrong error propagation
198
+
199
+ ### 5. Performance
200
+ - O(n²) algorithms
201
+ - Unnecessary memory allocation
202
+ - Inefficient data structures
203
+ - Cache miss patterns
204
+
205
+ ### 6. Code Quality
206
+ - Magic numbers
207
+ - Hardcoded values
208
+ - Complex functions
209
+ - Code duplication
210
+
211
+ ### 7. API Usage
212
+ - Deprecated functions
213
+ - Wrong API usage
214
+ - Missing parameter validation
215
+ - Incorrect flags
216
+
217
+ ## 📊 Analysis Features
218
+
219
+ - **Pattern-based Detection:** Regular expression matching with context awareness
220
+ - **Parallel Processing:** Configurable concurrent analysis for performance
221
+ - **Detailed Reporting:** JSON output with file locations and line numbers
222
+ - **Interactive Viewer:** Browse and filter results by category and severity
223
+ - **Code Snippet Extraction:** View actual code around detected issues
224
+ - **Severity Classification:** Critical, High, Medium, Low priority levels
225
+
226
+ ## 🔧 Configuration
227
+
228
+ The analysis can be customized through `tools/detectors/config.yaml`:
229
+
230
+ ```yaml
231
+ detection_rules:
232
+ memory_management:
233
+ enabled: true
234
+ severity: "high"
235
+ patterns:
236
+ - "kmalloc.*without.*kfree"
237
+ - "use.*after.*free"
238
+ directories: ["drivers", "kernel", "mm"]
239
+ ```
240
+
241
+ ## 📈 Performance
242
+
243
+ - **Analysis Speed:** ~11 minutes for 35,588 files
244
+ - **Memory Usage:** Configurable limits (default: 1GB)
245
+ - **Parallel Processing:** Up to 4 concurrent analyzers
246
+ - **File Filtering:** Excludes generated files and build artifacts
247
+
248
+ ## 🤝 Contributing
249
+
250
+ 1. **Fork the repository**
251
+ 2. **Create a feature branch** (`git checkout -b feature/amazing-feature`)
252
+ 3. **Add your changes** following the project structure
253
+ 4. **Test your changes** (`python -m pytest tests/`)
254
+ 5. **Commit your changes** (`git commit -m 'Add amazing feature'`)
255
+ 6. **Push to the branch** (`git push origin feature/amazing-feature`)
256
+ 7. **Open a Pull Request**
257
+
258
+ ### Development Guidelines
259
+ - **Analysis scripts:** Add to `scripts/analysis/`
260
+ - **Reporting tools:** Add to `scripts/reporting/`
261
+ - **Core detection:** Add to `src/detectors/`
262
+ - **Configuration:** Update `tools/detectors/config.yaml`
263
+
264
+ ## 📚 Documentation
265
+
266
+ - **[Project Structure](PROJECT_STRUCTURE.md)** - Detailed project organization
267
+ - **[Kernel Analysis Guide](docs/kernel-analysis-guide.md)** - Comprehensive analysis guide
268
+ - **[Concurrency Analysis](reports/concurrency/Concurrency_Analysis_Report.md)** - Concurrency-specific findings
269
+
270
+ ## 🐛 Known Issues
271
+
272
+ - **Code snippet extraction:** Some file paths may not match due to kernel cloning method
273
+ - **Large file handling:** Files >10MB are skipped to prevent memory issues
274
+ - **Pattern accuracy:** Some patterns may generate false positives
275
+
276
+ ## 📄 License
277
+
278
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
279
+
280
+ ## 🙏 Acknowledgments
281
+
282
+ - Linux kernel community for the source code
283
+ - Static analysis research community
284
+ - Contributors and maintainers
285
+
286
+ ## 📞 Contact
287
+
288
+ - **Repository:** https://github.com/Mac-Huang/linux-kernel-anti-pattern-detector
289
+ - **Issues:** Use GitHub Issues for bug reports and feature requests
290
+ - **Discussions:** Use GitHub Discussions for questions and ideas
291
+
292
  ---
293
+
294
+ *This tool is designed to help improve Linux kernel code quality by identifying potential issues early in the development process. The analysis results should be used as guidance for improvement rather than definitive assessments of code quality.*
adapter_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df755384ffd5359513ac7a725ba0c4d3104e6b5c131f98aee0b1cb7d160c17c0
3
+ size 839
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73618dfb9cd2422a1a6600a5cec7fc1178bfe579e0c77d827761f26eeaae7f09
3
+ size 134235048
chat_template.jinja ADDED
@@ -0,0 +1 @@
 
 
1
+ {% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<<SYS>>\n' + system_message + '\n<</SYS>>\n\n' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ bos_token + '[INST] ' + content | trim + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ ' ' + content | trim + ' ' + eos_token }}{% endif %}{% endfor %}
checkpoint-1000/README.md ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: codellama/CodeLLaMA-7b-Instruct-hf
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - base_model:adapter:codellama/CodeLLaMA-7b-Instruct-hf
7
+ - lora
8
+ - transformers
9
+ ---
10
+
11
+ # Model Card for Model ID
12
+
13
+ <!-- Provide a quick summary of what the model is/does. -->
14
+
15
+
16
+
17
+ ## Model Details
18
+
19
+ ### Model Description
20
+
21
+ <!-- Provide a longer summary of what this model is. -->
22
+
23
+
24
+
25
+ - **Developed by:** [More Information Needed]
26
+ - **Funded by [optional]:** [More Information Needed]
27
+ - **Shared by [optional]:** [More Information Needed]
28
+ - **Model type:** [More Information Needed]
29
+ - **Language(s) (NLP):** [More Information Needed]
30
+ - **License:** [More Information Needed]
31
+ - **Finetuned from model [optional]:** [More Information Needed]
32
+
33
+ ### Model Sources [optional]
34
+
35
+ <!-- Provide the basic links for the model. -->
36
+
37
+ - **Repository:** [More Information Needed]
38
+ - **Paper [optional]:** [More Information Needed]
39
+ - **Demo [optional]:** [More Information Needed]
40
+
41
+ ## Uses
42
+
43
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
44
+
45
+ ### Direct Use
46
+
47
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
48
+
49
+ [More Information Needed]
50
+
51
+ ### Downstream Use [optional]
52
+
53
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
54
+
55
+ [More Information Needed]
56
+
57
+ ### Out-of-Scope Use
58
+
59
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
60
+
61
+ [More Information Needed]
62
+
63
+ ## Bias, Risks, and Limitations
64
+
65
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
66
+
67
+ [More Information Needed]
68
+
69
+ ### Recommendations
70
+
71
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
72
+
73
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
74
+
75
+ ## How to Get Started with the Model
76
+
77
+ Use the code below to get started with the model.
78
+
79
+ [More Information Needed]
80
+
81
+ ## Training Details
82
+
83
+ ### Training Data
84
+
85
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
86
+
87
+ [More Information Needed]
88
+
89
+ ### Training Procedure
90
+
91
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
92
+
93
+ #### Preprocessing [optional]
94
+
95
+ [More Information Needed]
96
+
97
+
98
+ #### Training Hyperparameters
99
+
100
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
101
+
102
+ #### Speeds, Sizes, Times [optional]
103
+
104
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
105
+
106
+ [More Information Needed]
107
+
108
+ ## Evaluation
109
+
110
+ <!-- This section describes the evaluation protocols and provides the results. -->
111
+
112
+ ### Testing Data, Factors & Metrics
113
+
114
+ #### Testing Data
115
+
116
+ <!-- This should link to a Dataset Card if possible. -->
117
+
118
+ [More Information Needed]
119
+
120
+ #### Factors
121
+
122
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
123
+
124
+ [More Information Needed]
125
+
126
+ #### Metrics
127
+
128
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
129
+
130
+ [More Information Needed]
131
+
132
+ ### Results
133
+
134
+ [More Information Needed]
135
+
136
+ #### Summary
137
+
138
+
139
+
140
+ ## Model Examination [optional]
141
+
142
+ <!-- Relevant interpretability work for the model goes here -->
143
+
144
+ [More Information Needed]
145
+
146
+ ## Environmental Impact
147
+
148
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
149
+
150
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
151
+
152
+ - **Hardware Type:** [More Information Needed]
153
+ - **Hours used:** [More Information Needed]
154
+ - **Cloud Provider:** [More Information Needed]
155
+ - **Compute Region:** [More Information Needed]
156
+ - **Carbon Emitted:** [More Information Needed]
157
+
158
+ ## Technical Specifications [optional]
159
+
160
+ ### Model Architecture and Objective
161
+
162
+ [More Information Needed]
163
+
164
+ ### Compute Infrastructure
165
+
166
+ [More Information Needed]
167
+
168
+ #### Hardware
169
+
170
+ [More Information Needed]
171
+
172
+ #### Software
173
+
174
+ [More Information Needed]
175
+
176
+ ## Citation [optional]
177
+
178
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
179
+
180
+ **BibTeX:**
181
+
182
+ [More Information Needed]
183
+
184
+ **APA:**
185
+
186
+ [More Information Needed]
187
+
188
+ ## Glossary [optional]
189
+
190
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
191
+
192
+ [More Information Needed]
193
+
194
+ ## More Information [optional]
195
+
196
+ [More Information Needed]
197
+
198
+ ## Model Card Authors [optional]
199
+
200
+ [More Information Needed]
201
+
202
+ ## Model Card Contact
203
+
204
+ [More Information Needed]
205
+ ### Framework versions
206
+
207
+ - PEFT 0.16.0
checkpoint-1000/adapter_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1964c3b05fe32e3371262e1acac8e947ef8f8a52431e37716f780afe50727087
3
+ size 839
checkpoint-1000/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84064653aacb1aa638242fa35d96415845184e3f97cec4da4bc9412385f7aff9
3
+ size 134235048
checkpoint-1000/chat_template.jinja ADDED
@@ -0,0 +1 @@
 
 
1
+ {% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<<SYS>>\n' + system_message + '\n<</SYS>>\n\n' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ bos_token + '[INST] ' + content | trim + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ ' ' + content | trim + ' ' + eos_token }}{% endif %}{% endfor %}
checkpoint-1000/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e69ea177eb91af1890ec93a594282aef22499e4743b53c958f27820bc33d28e
3
+ size 268544075
checkpoint-1000/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8ecd469a8b4c7959941512dc268004dd3111ea9235d256aa9638ce00699c0f2
3
+ size 14645
checkpoint-1000/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cee0966af6e7296ad683b3f293ade83fe035fb7007b575377ad7775d13ec8b46
3
+ size 1465
checkpoint-1000/special_tokens_map.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f32ca2dd65336aceb9e359886f34f214330137c9e801e8f41cf542287fc2630
3
+ size 538
checkpoint-1000/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef304ea6a0a92c4275c959dd6e1a896bca7e36af0adb2ce25563e7c11bf3927f
3
+ size 3620829
checkpoint-1000/tokenizer_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ee02c4a9abf3f4b4fb350d0991f5313bd354c5dd76cabedaacc9e3e1c088e1a
3
+ size 1869
checkpoint-1000/trainer_state.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e448dea2040f629a632432c297857131d1b3ac2ccdb25548b1cb4fe4ec5d779f
3
+ size 4295
checkpoint-1000/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7cca9708d68b5d07e91505e97d7945c08ed5c660e02fce750706e45d57565144
3
+ size 5777
checkpoint-500/README.md ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: codellama/CodeLLaMA-7b-Instruct-hf
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - base_model:adapter:codellama/CodeLLaMA-7b-Instruct-hf
7
+ - lora
8
+ - transformers
9
+ ---
10
+
11
+ # Model Card for Model ID
12
+
13
+ <!-- Provide a quick summary of what the model is/does. -->
14
+
15
+
16
+
17
+ ## Model Details
18
+
19
+ ### Model Description
20
+
21
+ <!-- Provide a longer summary of what this model is. -->
22
+
23
+
24
+
25
+ - **Developed by:** [More Information Needed]
26
+ - **Funded by [optional]:** [More Information Needed]
27
+ - **Shared by [optional]:** [More Information Needed]
28
+ - **Model type:** [More Information Needed]
29
+ - **Language(s) (NLP):** [More Information Needed]
30
+ - **License:** [More Information Needed]
31
+ - **Finetuned from model [optional]:** [More Information Needed]
32
+
33
+ ### Model Sources [optional]
34
+
35
+ <!-- Provide the basic links for the model. -->
36
+
37
+ - **Repository:** [More Information Needed]
38
+ - **Paper [optional]:** [More Information Needed]
39
+ - **Demo [optional]:** [More Information Needed]
40
+
41
+ ## Uses
42
+
43
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
44
+
45
+ ### Direct Use
46
+
47
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
48
+
49
+ [More Information Needed]
50
+
51
+ ### Downstream Use [optional]
52
+
53
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
54
+
55
+ [More Information Needed]
56
+
57
+ ### Out-of-Scope Use
58
+
59
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
60
+
61
+ [More Information Needed]
62
+
63
+ ## Bias, Risks, and Limitations
64
+
65
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
66
+
67
+ [More Information Needed]
68
+
69
+ ### Recommendations
70
+
71
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
72
+
73
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
74
+
75
+ ## How to Get Started with the Model
76
+
77
+ Use the code below to get started with the model.
78
+
79
+ [More Information Needed]
80
+
81
+ ## Training Details
82
+
83
+ ### Training Data
84
+
85
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
86
+
87
+ [More Information Needed]
88
+
89
+ ### Training Procedure
90
+
91
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
92
+
93
+ #### Preprocessing [optional]
94
+
95
+ [More Information Needed]
96
+
97
+
98
+ #### Training Hyperparameters
99
+
100
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
101
+
102
+ #### Speeds, Sizes, Times [optional]
103
+
104
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
105
+
106
+ [More Information Needed]
107
+
108
+ ## Evaluation
109
+
110
+ <!-- This section describes the evaluation protocols and provides the results. -->
111
+
112
+ ### Testing Data, Factors & Metrics
113
+
114
+ #### Testing Data
115
+
116
+ <!-- This should link to a Dataset Card if possible. -->
117
+
118
+ [More Information Needed]
119
+
120
+ #### Factors
121
+
122
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
123
+
124
+ [More Information Needed]
125
+
126
+ #### Metrics
127
+
128
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
129
+
130
+ [More Information Needed]
131
+
132
+ ### Results
133
+
134
+ [More Information Needed]
135
+
136
+ #### Summary
137
+
138
+
139
+
140
+ ## Model Examination [optional]
141
+
142
+ <!-- Relevant interpretability work for the model goes here -->
143
+
144
+ [More Information Needed]
145
+
146
+ ## Environmental Impact
147
+
148
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
149
+
150
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
151
+
152
+ - **Hardware Type:** [More Information Needed]
153
+ - **Hours used:** [More Information Needed]
154
+ - **Cloud Provider:** [More Information Needed]
155
+ - **Compute Region:** [More Information Needed]
156
+ - **Carbon Emitted:** [More Information Needed]
157
+
158
+ ## Technical Specifications [optional]
159
+
160
+ ### Model Architecture and Objective
161
+
162
+ [More Information Needed]
163
+
164
+ ### Compute Infrastructure
165
+
166
+ [More Information Needed]
167
+
168
+ #### Hardware
169
+
170
+ [More Information Needed]
171
+
172
+ #### Software
173
+
174
+ [More Information Needed]
175
+
176
+ ## Citation [optional]
177
+
178
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
179
+
180
+ **BibTeX:**
181
+
182
+ [More Information Needed]
183
+
184
+ **APA:**
185
+
186
+ [More Information Needed]
187
+
188
+ ## Glossary [optional]
189
+
190
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
191
+
192
+ [More Information Needed]
193
+
194
+ ## More Information [optional]
195
+
196
+ [More Information Needed]
197
+
198
+ ## Model Card Authors [optional]
199
+
200
+ [More Information Needed]
201
+
202
+ ## Model Card Contact
203
+
204
+ [More Information Needed]
205
+ ### Framework versions
206
+
207
+ - PEFT 0.16.0
checkpoint-500/adapter_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1964c3b05fe32e3371262e1acac8e947ef8f8a52431e37716f780afe50727087
3
+ size 839
checkpoint-500/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ddc3978f5ac8ec8f6c879f16e4deab2f4955796fc45daaf9fd7063d6b270b027
3
+ size 134235048
checkpoint-500/chat_template.jinja ADDED
@@ -0,0 +1 @@
 
 
1
+ {% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<<SYS>>\n' + system_message + '\n<</SYS>>\n\n' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ bos_token + '[INST] ' + content | trim + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ ' ' + content | trim + ' ' + eos_token }}{% endif %}{% endfor %}
checkpoint-500/optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e0ede750ff79b1bb5285ab51d0e4b03eeec5f4673ac149f1e973b6d20ad8e91
3
+ size 268544075
checkpoint-500/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:873492f033797d17bd144ec6ef43f5efb66933cf27e0c60ddd8d799f5d1f12c1
3
+ size 14645
checkpoint-500/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b1492973eb5cd9c3e10c1c7ee7c4d19bcd22481640c90b6278d1a21419300ba9
3
+ size 1465
checkpoint-500/special_tokens_map.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f32ca2dd65336aceb9e359886f34f214330137c9e801e8f41cf542287fc2630
3
+ size 538
checkpoint-500/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef304ea6a0a92c4275c959dd6e1a896bca7e36af0adb2ce25563e7c11bf3927f
3
+ size 3620829
checkpoint-500/tokenizer_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ee02c4a9abf3f4b4fb350d0991f5313bd354c5dd76cabedaacc9e3e1c088e1a
3
+ size 1869
checkpoint-500/trainer_state.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22d7fb0a27cf19e9d2091a0f3a62b86790ee0448da788f1599a6b1e4e2a83e84
3
+ size 2543
checkpoint-500/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7cca9708d68b5d07e91505e97d7945c08ed5c660e02fce750706e45d57565144
3
+ size 5777
special_tokens_map.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f32ca2dd65336aceb9e359886f34f214330137c9e801e8f41cf542287fc2630
3
+ size 538
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef304ea6a0a92c4275c959dd6e1a896bca7e36af0adb2ce25563e7c11bf3927f
3
+ size 3620829
tokenizer_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ee02c4a9abf3f4b4fb350d0991f5313bd354c5dd76cabedaacc9e3e1c088e1a
3
+ size 1869