Update README.md
Browse files
README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
# Model Card for Model ID
|
|
@@ -20,13 +22,6 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
| 20 |
- **Model type:** google/gemma-2b
|
| 21 |
- **Finetuned from model [optional]:** google/gemma-2b-it
|
| 22 |
|
| 23 |
-
### Model Sources [optional]
|
| 24 |
-
|
| 25 |
-
<!-- Provide the basic links for the model. -->
|
| 26 |
-
|
| 27 |
-
- **Repository:** [More Information Needed]
|
| 28 |
-
- **Paper [optional]:** [More Information Needed]
|
| 29 |
-
- **Demo [optional]:** [More Information Needed]
|
| 30 |
|
| 31 |
## Uses
|
| 32 |
|
|
@@ -35,32 +30,34 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
| 35 |
### Direct Use
|
| 36 |
|
| 37 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
|
|
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
### Out-of-Scope Use
|
| 48 |
|
| 49 |
-
|
| 50 |
|
| 51 |
-
|
| 52 |
|
| 53 |
-
## Bias, Risks, and Limitations
|
| 54 |
|
| 55 |
-
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
[More Information Needed]
|
| 58 |
|
| 59 |
-
###
|
| 60 |
|
| 61 |
-
<!-- This section
|
|
|
|
| 62 |
|
| 63 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 64 |
|
| 65 |
## How to Get Started with the Model
|
| 66 |
|
|
@@ -70,68 +67,63 @@ Use the code below to get started with the model.
|
|
| 70 |
|
| 71 |
## Training Details
|
| 72 |
|
|
|
|
| 73 |
### Training Data
|
| 74 |
|
| 75 |
<!-- 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. -->
|
| 76 |
|
| 77 |
-
|
|
|
|
| 78 |
|
| 79 |
### Training Procedure
|
| 80 |
|
| 81 |
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 82 |
|
| 83 |
-
#### Preprocessing [optional]
|
| 84 |
-
|
| 85 |
-
[More Information Needed]
|
| 86 |
-
|
| 87 |
|
| 88 |
#### Training Hyperparameters
|
| 89 |
|
| 90 |
-
- **Training regime:**
|
| 91 |
-
|
| 92 |
-
#### Speeds, Sizes, Times [optional]
|
| 93 |
-
|
| 94 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 95 |
-
|
| 96 |
-
[More Information Needed]
|
| 97 |
|
| 98 |
## Evaluation
|
| 99 |
-
|
| 100 |
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 101 |
|
| 102 |
-
|
|
|
|
| 103 |
|
| 104 |
#### Testing Data
|
| 105 |
|
| 106 |
<!-- This should link to a Dataset Card if possible. -->
|
| 107 |
|
| 108 |
-
[
|
| 109 |
-
|
| 110 |
-
#### Factors
|
| 111 |
|
| 112 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 113 |
-
|
| 114 |
-
[More Information Needed]
|
| 115 |
|
| 116 |
#### Metrics
|
| 117 |
|
| 118 |
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 119 |
|
| 120 |
-
|
|
|
|
|
|
|
| 121 |
|
| 122 |
### Results
|
| 123 |
|
| 124 |
[More Information Needed]
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
-
|
| 127 |
-
|
|
|
|
| 128 |
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
-
|
| 131 |
|
| 132 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 133 |
|
| 134 |
-
[More Information Needed]
|
| 135 |
|
| 136 |
## Environmental Impact
|
| 137 |
|
|
@@ -139,58 +131,28 @@ Use the code below to get started with the model.
|
|
| 139 |
|
| 140 |
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).
|
| 141 |
|
| 142 |
-
- **Hardware Type:**
|
| 143 |
-
- **Hours used:**
|
| 144 |
-
- **Cloud Provider:**
|
| 145 |
-
|
| 146 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 147 |
|
| 148 |
## Technical Specifications [optional]
|
| 149 |
|
| 150 |
### Model Architecture and Objective
|
| 151 |
|
| 152 |
-
[More Information Needed]
|
| 153 |
-
|
| 154 |
-
### Compute Infrastructure
|
| 155 |
-
|
| 156 |
-
[More Information Needed]
|
| 157 |
-
|
| 158 |
#### Hardware
|
| 159 |
|
| 160 |
-
|
|
|
|
|
|
|
| 161 |
|
| 162 |
#### Software
|
| 163 |
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
**BibTeX:**
|
| 171 |
-
|
| 172 |
-
[More Information Needed]
|
| 173 |
-
|
| 174 |
-
**APA:**
|
| 175 |
-
|
| 176 |
-
[More Information Needed]
|
| 177 |
-
|
| 178 |
-
## Glossary [optional]
|
| 179 |
-
|
| 180 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 181 |
-
|
| 182 |
-
[More Information Needed]
|
| 183 |
-
|
| 184 |
-
## More Information [optional]
|
| 185 |
-
|
| 186 |
-
[More Information Needed]
|
| 187 |
-
|
| 188 |
-
## Model Card Authors [optional]
|
| 189 |
-
|
| 190 |
-
[More Information Needed]
|
| 191 |
-
|
| 192 |
-
## Model Card Contact
|
| 193 |
-
|
| 194 |
-
[More Information Needed]
|
| 195 |
|
| 196 |
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
metrics:
|
| 4 |
+
- bleu : 0.67
|
| 5 |
+
- chrf : 0.73
|
| 6 |
---
|
| 7 |
|
| 8 |
# Model Card for Model ID
|
|
|
|
| 22 |
- **Model type:** google/gemma-2b
|
| 23 |
- **Finetuned from model [optional]:** google/gemma-2b-it
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
## Uses
|
| 27 |
|
|
|
|
| 30 |
### Direct Use
|
| 31 |
|
| 32 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 33 |
+
Use this model to generate Python code."
|
| 34 |
|
| 35 |
+
```python
|
| 36 |
+
# Load model directly
|
| 37 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 38 |
|
| 39 |
+
model_id = "mrSoul7766/gemma-2b-it-python-code-gen-adapter"
|
| 40 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 41 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 42 |
|
| 43 |
+
text = """<start_of_turn>Convert JSON data to a CSV file<end_of_turn>
|
| 44 |
+
<start_of_turn>model"""
|
|
|
|
| 45 |
|
| 46 |
+
#device = "cuda:0"
|
| 47 |
|
| 48 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 49 |
|
|
|
|
| 50 |
|
| 51 |
+
outputs = model.generate(**inputs, max_new_tokens=200)
|
| 52 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 53 |
+
```
|
| 54 |
|
|
|
|
| 55 |
|
| 56 |
+
### Out-of-Scope Use
|
| 57 |
|
| 58 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 59 |
+
This model is trained on very basic Python code, so it might not be able to handle complex code.
|
| 60 |
|
|
|
|
| 61 |
|
| 62 |
## How to Get Started with the Model
|
| 63 |
|
|
|
|
| 67 |
|
| 68 |
## Training Details
|
| 69 |
|
| 70 |
+
|
| 71 |
### Training Data
|
| 72 |
|
| 73 |
<!-- 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. -->
|
| 74 |
|
| 75 |
+
**Fine-tuning Data:** [flytech/python-codes-25k](https://huggingface.co/datasets/flytech/python-codes-25k/viewer/default/train?p=2&row=294)
|
| 76 |
+
|
| 77 |
|
| 78 |
### Training Procedure
|
| 79 |
|
| 80 |
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
#### Training Hyperparameters
|
| 84 |
|
| 85 |
+
- **Training regime:** fp16 <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 86 |
+
- **learning_rate:** 2e-4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
## Evaluation
|
|
|
|
| 89 |
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 90 |
|
| 91 |
+
|
| 92 |
+
### Testing Data & Metrics
|
| 93 |
|
| 94 |
#### Testing Data
|
| 95 |
|
| 96 |
<!-- This should link to a Dataset Card if possible. -->
|
| 97 |
|
| 98 |
+
[iamtarun/python_code_instructions_18k_alpaca](https://huggingface.co/datasets/iamtarun/python_code_instructions_18k_alpaca?row=44)
|
|
|
|
|
|
|
| 99 |
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
#### Metrics
|
| 102 |
|
| 103 |
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 104 |
|
| 105 |
+
- **chrf:** 0.73
|
| 106 |
+
- **codeblue:** 0.67
|
| 107 |
+
- **codeblue_ngram:** 0.53
|
| 108 |
|
| 109 |
### Results
|
| 110 |
|
| 111 |
[More Information Needed]
|
| 112 |
+
```python
|
| 113 |
+
import json
|
| 114 |
+
import pandas as pd
|
| 115 |
|
| 116 |
+
# Load the JSON data
|
| 117 |
+
with open('data.json', 'r') as f:
|
| 118 |
+
data = json.load(f)
|
| 119 |
|
| 120 |
+
# Create the DataFrame
|
| 121 |
+
df = pd.DataFrame(data)
|
| 122 |
+
```
|
| 123 |
|
| 124 |
+
#### Summary
|
| 125 |
|
|
|
|
| 126 |
|
|
|
|
| 127 |
|
| 128 |
## Environmental Impact
|
| 129 |
|
|
|
|
| 131 |
|
| 132 |
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).
|
| 133 |
|
| 134 |
+
- **Hardware Type:** H100
|
| 135 |
+
- **Hours used:** 30 minutes
|
| 136 |
+
- **Cloud Provider:** Google-cloud
|
| 137 |
+
|
|
|
|
| 138 |
|
| 139 |
## Technical Specifications [optional]
|
| 140 |
|
| 141 |
### Model Architecture and Objective
|
| 142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
#### Hardware
|
| 144 |
|
| 145 |
+
- **Hardware Type:** H100
|
| 146 |
+
- **Hours used:** 30 minutes
|
| 147 |
+
- **Cloud Provider:** Google-cloud
|
| 148 |
|
| 149 |
#### Software
|
| 150 |
|
| 151 |
+
- bitsandbytes==0.42.0
|
| 152 |
+
- peft==0.8.2
|
| 153 |
+
- trl==0.7.10
|
| 154 |
+
- accelerate==0.27.1
|
| 155 |
+
- datasets==2.17.0
|
| 156 |
+
- transformers==4.38.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
|