Update README.md
Browse files
README.md
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
---
|
2 |
base_model: unsloth/llama-3-8b-bnb-4bit
|
3 |
library_name: peft
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
# Model
|
7 |
-
|
8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
## Model Details
|
13 |
|
14 |
### Model Description
|
15 |
|
16 |
-
|
|
|
|
|
|
|
17 |
|
18 |
|
19 |
-
|
20 |
-
- **
|
21 |
-
- **
|
22 |
-
- **
|
23 |
-
- **
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
### Model Sources [optional]
|
29 |
|
@@ -35,43 +35,82 @@ library_name: peft
|
|
35 |
|
36 |
## Uses
|
37 |
|
38 |
-
|
39 |
-
|
40 |
### Direct Use
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
|
46 |
### Downstream Use [optional]
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
|
52 |
### Out-of-Scope Use
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
|
58 |
## Bias, Risks, and Limitations
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
|
64 |
### Recommendations
|
65 |
|
66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
-
|
68 |
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
|
70 |
## How to Get Started with the Model
|
71 |
|
72 |
Use the code below to get started with the model.
|
73 |
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
## Training Details
|
77 |
|
@@ -92,7 +131,11 @@ Use the code below to get started with the model.
|
|
92 |
|
93 |
#### Training Hyperparameters
|
94 |
|
95 |
-
- **Training regime:**
|
|
|
|
|
|
|
|
|
96 |
|
97 |
#### Speeds, Sizes, Times [optional]
|
98 |
|
@@ -138,18 +181,6 @@ Use the code below to get started with the model.
|
|
138 |
|
139 |
[More Information Needed]
|
140 |
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
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).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
## Technical Specifications [optional]
|
154 |
|
155 |
### Model Architecture and Objective
|
@@ -176,27 +207,15 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
|
|
176 |
|
177 |
[More Information Needed]
|
178 |
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
|
189 |
## More Information [optional]
|
190 |
|
191 |
[More Information Needed]
|
192 |
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
-
|
197 |
## Model Card Contact
|
198 |
|
199 |
-
|
|
|
200 |
### Framework versions
|
201 |
|
202 |
- PEFT 0.12.0
|
|
|
1 |
---
|
2 |
base_model: unsloth/llama-3-8b-bnb-4bit
|
3 |
library_name: peft
|
4 |
+
license: mit
|
5 |
+
datasets:
|
6 |
+
- matiusX/legislacao-ufam
|
7 |
+
language:
|
8 |
+
- pt
|
9 |
+
- en
|
10 |
---
|
11 |
|
12 |
+
# Model Details
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
### Model Description
|
15 |
|
16 |
+
This model is a fine-tuned version of LLaMA 3 utilizing the Quantized Low-Rank Adaptation (QLoRA) technique.
|
17 |
+
It is designed to answer questions related to the academic legislation of the Universidade Federal do Amazonas (UFAM).
|
18 |
+
The training process involved generating a synthetic dataset of questions and answers based on the legislation,
|
19 |
+
which includes various resolutions and norms provided by UFAM.
|
20 |
|
21 |
|
22 |
+
- **Developed by:** Matheus dos Santos Palheta
|
23 |
+
- **Model type:** More Information Needed
|
24 |
+
- **Language(s) (NLP):** Portuguese, english
|
25 |
+
- **License:** MIT
|
26 |
+
- **Finetuned from model:** unsloth/llama-3-8b-bnb-4bit
|
|
|
|
|
|
|
27 |
|
28 |
### Model Sources [optional]
|
29 |
|
|
|
35 |
|
36 |
## Uses
|
37 |
|
38 |
+
This model is intended for use by anyone with questions about UFAM's legislation. It is especially designed for students, professors, and administrative staff who need quick and accurate answers regarding academic policies and regulations. The model aims to support these groups by providing reliable information, thereby facilitating a better understanding of the rules and guidelines that govern their academic and professional activities at UFAM.
|
|
|
39 |
### Direct Use
|
40 |
|
41 |
+
This model can be directly used to answer questions regarding UFAM's academic legislation without additional fine-tuning.
|
|
|
|
|
42 |
|
43 |
### Downstream Use [optional]
|
44 |
|
45 |
+
The model can be integrated into larger ecosystems or applications, particularly those focusing on academic information systems,
|
46 |
+
legal information retrieval, or automated student support systems from UFAM.
|
|
|
47 |
|
48 |
### Out-of-Scope Use
|
49 |
|
50 |
+
This model is not suitable for general-purpose question answering beyond the scope of UFAM's academic legislation.
|
51 |
+
It should not be used for legal advice or any critical decision-making processes outside its trained domain.
|
|
|
52 |
|
53 |
## Bias, Risks, and Limitations
|
54 |
|
55 |
+
While the model has been fine-tuned for accuracy in the context of UFAM's legislation, it may still exhibit biases present in the training data.
|
56 |
+
Additionally, the model's performance is constrained by the quality and comprehensiveness of the synthetic dataset generated.
|
|
|
57 |
|
58 |
### Recommendations
|
59 |
|
|
|
|
|
60 |
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
61 |
|
62 |
## How to Get Started with the Model
|
63 |
|
64 |
Use the code below to get started with the model.
|
65 |
|
66 |
+
```python
|
67 |
+
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
68 |
+
!pip install --no-deps "xformers<0.0.27" "trl<0.9.0" peft accelerate bitsandbytes
|
69 |
+
|
70 |
+
from datasets import load_dataset
|
71 |
+
from datasets import Dataset
|
72 |
+
import pandas as pd
|
73 |
+
|
74 |
+
from unsloth import FastLanguageModel
|
75 |
+
import torch
|
76 |
+
max_seq_length = 2048
|
77 |
+
dtype = None
|
78 |
+
load_in_4bit = True
|
79 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
80 |
+
model_name = "matiusX/lamma-legis-ufam",
|
81 |
+
max_seq_length = max_seq_length,
|
82 |
+
dtype = dtype,
|
83 |
+
load_in_4bit = load_in_4bit,
|
84 |
+
)
|
85 |
+
FastLanguageModel.for_inference(model)
|
86 |
+
|
87 |
+
prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
88 |
+
|
89 |
+
### Instruction:
|
90 |
+
{}
|
91 |
+
|
92 |
+
### Input:
|
93 |
+
{}
|
94 |
+
|
95 |
+
### Response:
|
96 |
+
{}"""
|
97 |
+
|
98 |
+
inputs = tokenizer(
|
99 |
+
[
|
100 |
+
prompt.format(
|
101 |
+
contexto, # contexto
|
102 |
+
pergunta, # pergunta
|
103 |
+
"", # resposta - deixar em branco
|
104 |
+
)
|
105 |
+
], return_tensors = "pt").to("cuda")
|
106 |
+
|
107 |
+
outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
|
108 |
+
tokenizer.batch_decode(outputs)
|
109 |
+
|
110 |
+
from transformers import TextStreamer
|
111 |
+
text_streamer = TextStreamer(tokenizer, skip_prompt=True)
|
112 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128)
|
113 |
+
```
|
114 |
|
115 |
## Training Details
|
116 |
|
|
|
131 |
|
132 |
#### Training Hyperparameters
|
133 |
|
134 |
+
- **Training regime:** Mixed precision (fp16)
|
135 |
+
- **LoRA configuration:**
|
136 |
+
- **Alpha:** 16
|
137 |
+
- **Dropout:** 0
|
138 |
+
- **Target modules:** down_proj, up_proj, q_proj, gate_proj, v_proj, o_proj, k_proj
|
139 |
|
140 |
#### Speeds, Sizes, Times [optional]
|
141 |
|
|
|
181 |
|
182 |
[More Information Needed]
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
## Technical Specifications [optional]
|
185 |
|
186 |
### Model Architecture and Objective
|
|
|
207 |
|
208 |
[More Information Needed]
|
209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
|
211 |
## More Information [optional]
|
212 |
|
213 |
[More Information Needed]
|
214 |
|
|
|
|
|
|
|
|
|
215 |
## Model Card Contact
|
216 |
|
217 | |
218 |
+
|
219 |
### Framework versions
|
220 |
|
221 |
- PEFT 0.12.0
|