Update
Browse files
README.md
CHANGED
|
@@ -1,207 +1,94 @@
|
|
| 1 |
-
---
|
| 2 |
base_model: codellama/CodeLlama-7b-hf
|
| 3 |
library_name: peft
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
tags:
|
| 6 |
-
- base_model:adapter:codellama/CodeLlama-7b-hf
|
| 7 |
-
- lora
|
| 8 |
-
- transformers
|
| 9 |
-
---
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
-
|
| 14 |
|
|
|
|
| 15 |
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
|
|
|
|
| 23 |
|
|
|
|
| 24 |
|
| 25 |
-
|
| 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 |
-
|
| 34 |
|
| 35 |
-
|
| 36 |
|
| 37 |
-
|
| 38 |
-
-
|
| 39 |
-
- **Demo [optional]:** [More Information Needed]
|
| 40 |
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
|
|
|
|
| 48 |
|
| 49 |
-
|
|
|
|
| 50 |
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
-
|
|
|
|
| 54 |
|
| 55 |
-
|
|
|
|
| 56 |
|
| 57 |
-
|
|
|
|
|
|
|
| 58 |
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
-
|
|
|
|
| 64 |
|
| 65 |
-
|
|
|
|
| 66 |
|
| 67 |
-
|
|
|
|
| 68 |
|
| 69 |
-
|
|
|
|
| 70 |
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 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.17.0
|
|
|
|
|
|
|
| 1 |
base_model: codellama/CodeLlama-7b-hf
|
| 2 |
library_name: peft
|
| 3 |
pipeline_tag: text-generation
|
| 4 |
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
base_model:adapter:codellama/CodeLlama-7b-hf
|
| 7 |
|
| 8 |
+
lora
|
| 9 |
|
| 10 |
+
transformers
|
| 11 |
|
| 12 |
+
Model Card for Arko007/my-awesome-code-assistant-v1
|
| 13 |
+
This is a fine-tuned version of the CodeLlama-7b-hf model, adapted for use as a code assistant. The model is trained to perform text-generation tasks, specifically focusing on code-related prompts.
|
| 14 |
|
| 15 |
+
Model Details
|
| 16 |
+
Model Description
|
| 17 |
+
This model is a parameter-efficient fine-tuned (PEFT) version of CodeLlama-7b-hf. It has been adapted using the LoRA method to specialize in generating and completing code snippets, answering questions about code, and assisting with general programming tasks. The primary goal is to provide an efficient and capable code-generation tool.
|
| 18 |
|
| 19 |
+
Developed by: Arko007
|
| 20 |
|
| 21 |
+
Funded by [optional]: [More Information Needed]
|
| 22 |
|
| 23 |
+
Shared by [optional]: Arko007
|
| 24 |
|
| 25 |
+
Model type: Causal Language Model, Fine-tuned for Code Generation
|
| 26 |
|
| 27 |
+
Language(s) (NLP): Natural language (English) and various programming languages.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
License: Unsure, likely inherited from the base model (CodeLlama-7b-hf). Please specify the license if it's different.
|
| 30 |
|
| 31 |
+
Finetuned from model [optional]: codellama/CodeLlama-7b-hf
|
| 32 |
|
| 33 |
+
Model Sources [optional]
|
| 34 |
+
Repository: https://huggingface.co/Arko007/my-awesome-code-assistant-v1
|
|
|
|
| 35 |
|
| 36 |
+
Paper [optional]: [More Information Needed]
|
| 37 |
|
| 38 |
+
Demo [optional]: [More Information Needed]
|
| 39 |
|
| 40 |
+
Uses
|
| 41 |
+
Direct Use
|
| 42 |
+
The model is intended for direct use in code-generation tasks. It can be used as a conversational code assistant or for completing code snippets based on a provided prompt.
|
| 43 |
|
| 44 |
+
Downstream Use [optional]
|
| 45 |
+
The model can be further fine-tuned for more specific coding tasks, such as generating code in a particular language or for a specific domain.
|
| 46 |
|
| 47 |
+
Out-of-Scope Use
|
| 48 |
+
The model is not intended for generating non-code-related text or for tasks requiring factual accuracy outside of the programming domain. Due to its training, it may not perform well on tasks outside of code generation.
|
| 49 |
|
| 50 |
+
Bias, Risks, and Limitations
|
| 51 |
+
This model inherits the biases and limitations of its base model, CodeLlama. It may generate incorrect, insecure, or inefficient code. It is recommended to always review and test the generated code.
|
| 52 |
|
| 53 |
+
Recommendations
|
| 54 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. It is crucial to verify the model's output before using it in a production environment.
|
| 55 |
|
| 56 |
+
How to Get Started with the Model
|
| 57 |
+
Use the code below to get started with the model. This example demonstrates how to load the base model and the PEFT adapter using the transformers library and generate text.
|
| 58 |
|
| 59 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 60 |
+
from peft import PeftModel, PeftConfig
|
| 61 |
+
import torch
|
| 62 |
|
| 63 |
+
# Load the PEFT configuration
|
| 64 |
+
peft_model_id = "Arko007/my-awesome-code-assistant-v1"
|
| 65 |
+
config = PeftConfig.from_pretrained(peft_model_id)
|
| 66 |
|
| 67 |
+
# Load the base model and tokenizer
|
| 68 |
+
# The base model is specified in the PEFT config
|
| 69 |
+
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path)
|
| 70 |
+
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
| 71 |
|
| 72 |
+
# Load the PEFT adapter
|
| 73 |
+
model = PeftModel.from_pretrained(model, peft_model_id)
|
| 74 |
|
| 75 |
+
# Set the model to evaluation mode
|
| 76 |
+
model.eval()
|
| 77 |
|
| 78 |
+
# Example prompt for code generation
|
| 79 |
+
prompt = "def fibonacci(n):"
|
| 80 |
|
| 81 |
+
# Tokenize the prompt
|
| 82 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 83 |
|
| 84 |
+
# Generate the code
|
| 85 |
+
with torch.no_grad():
|
| 86 |
+
outputs = model.generate(
|
| 87 |
+
**inputs,
|
| 88 |
+
max_length=100,
|
| 89 |
+
pad_token_id=tokenizer.eos_token_id
|
| 90 |
+
)
|
| 91 |
|
| 92 |
+
# Decode and print the generated output
|
| 93 |
+
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 94 |
+
print(generated_text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|