You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An exploration of the [Llama LoRA INT4 working example](examples/int4_finetuning/LLaMA_lora_int4.ipynb) is recommended for an understanding of its application.
100
+
An exploration of the [Llama LoRA INT4 working example](examples/features/int4_finetuning/LLaMA_lora_int4.ipynb) is recommended for an understanding of its application.
101
101
102
-
For an extended insight, consider examining the [GenericModel working example](examples/generic/generic_model.py) available in the repository.
102
+
For an extended insight, consider examining the [GenericModel working example](examples/features/generic/generic_model.py) available in the repository.
103
103
104
104
<br>
105
105
@@ -111,6 +111,7 @@ pip install xturing
111
111
<br>
112
112
113
113
## 🚀 Quickstart
114
+
114
115
```python
115
116
from xturing.datasets import InstructionDataset
116
117
from xturing.models import BaseModel
@@ -130,7 +131,7 @@ output = model.generate(texts=["Why LLM models are becoming so important?"])
130
131
print("Generated output by the model: {}".format(output))
131
132
```
132
133
133
-
You can find the data folder [here](examples/llama/alpaca_data).
134
+
You can find the data folder [here](examples/models/llama/alpaca_data).
-[Preparing your dataset](examples/llama/preparing_your_dataset.py)
168
-
-[Cerebras-GPT fine-tuning with LoRA and INT8](examples/cerebras/cerebras_lora_int8.ipynb) [](https://colab.research.google.com/drive/1eKq3oF7dnK8KuIfsTE70Gvvniwr1O9D0?usp=sharing)
169
-
-[Cerebras-GPT fine-tuning with LoRA](examples/cerebras/cerebras_lora.ipynb) [](https://colab.research.google.com/drive/1VjqQhstm5pT4EjPjx4Je7b3W2X1V3vDo?usp=sharing)
170
-
-[LLaMA fine-tuning with LoRA and INT8](examples/llama/llama_lora_int8.py) [](https://colab.research.google.com/drive/1SQUXq1AMZPSLD4mk3A3swUIc6Y2dclme?usp=sharing)
171
-
-[LLaMA fine-tuning with LoRA](examples/llama/llama_lora.py)
172
-
-[LLaMA fine-tuning](examples/llama/llama.py)
173
-
-[GPT-J fine-tuning with LoRA and INT8](examples/gptj/gptj_lora_int8.py) [](https://colab.research.google.com/drive/1hB_8s1V9K4IzifmlmN2AovGEJzTB1c7e?usp=sharing)
174
-
-[GPT-J fine-tuning with LoRA](examples/gptj/gptj_lora.py)
175
-
-[GPT-2 fine-tuning with LoRA](examples/gpt2/gpt2_lora.py) [](https://drive.google.com/file/d/1Sh-ocNpKn9pS7jv6oBb_Q8DitFyj1avL/view?usp=sharing)
168
+
-[Preparing your dataset](examples/datasets/preparing_your_dataset.py)
169
+
-[Cerebras-GPT fine-tuning with LoRA and INT8](examples/models/cerebras/cerebras_lora_int8.ipynb) [](https://colab.research.google.com/drive/1eKq3oF7dnK8KuIfsTE70Gvvniwr1O9D0?usp=sharing)
170
+
-[Cerebras-GPT fine-tuning with LoRA](examples/models/cerebras/cerebras_lora.ipynb) [](https://colab.research.google.com/drive/1VjqQhstm5pT4EjPjx4Je7b3W2X1V3vDo?usp=sharing)
171
+
-[LLaMA fine-tuning with LoRA and INT8](examples/models/llama/llama_lora_int8.py) [](https://colab.research.google.com/drive/1SQUXq1AMZPSLD4mk3A3swUIc6Y2dclme?usp=sharing)
172
+
-[LLaMA fine-tuning with LoRA](examples/models/llama/llama_lora.py)
-[GPT-J fine-tuning with LoRA and INT8](examples/models/gptj/gptj_lora_int8.py) [](https://colab.research.google.com/drive/1hB_8s1V9K4IzifmlmN2AovGEJzTB1c7e?usp=sharing)
175
+
-[GPT-J fine-tuning with LoRA](examples/models/gptj/gptj_lora.py)
176
+
-[GPT-2 fine-tuning with LoRA](examples/models/gpt2/gpt2_lora.py) [](https://drive.google.com/file/d/1Sh-ocNpKn9pS7jv6oBb_Q8DitFyj1avL/view?usp=sharing)
176
177
177
178
<br>
178
179
179
180
## 📊 Performance
180
181
181
-
Here is a comparison for the performance of different fine-tuning techniques on the LLaMA 7B model. We use the [Alpaca dataset](examples/llama/alpaca_data/) for fine-tuning. The dataset contains 52K instructions.
182
+
Here is a comparison for the performance of different fine-tuning techniques on the LLaMA 7B model. We use the [Alpaca dataset](examples/models/llama/alpaca_data/) for fine-tuning. The dataset contains 52K instructions.
Here, is a brief about how to navigate through examples quick and efficiently, and get your hands dirty with `xTuring`.
3
+
4
+
## Directory structure
5
+
```
6
+
examples/
7
+
| datasets
8
+
| features/
9
+
| dataset_generation/
10
+
| evaluation/
11
+
| generic/
12
+
| int4_finetuning/
13
+
| models/
14
+
| playground_ui/
15
+
```
16
+
17
+
### datsets/
18
+
This directory consists of multiple ways to generate your custom dataset from a given set of examples.
19
+
20
+
### features/
21
+
This directory consists of files with exapmles highlighting speific major features of the library, which can be replicated to any LLM you want.
22
+
For example, in `dataset_generation/`, you will find an example on how to generate your custom dataset from a .jsonl file. In `evaluation/`, you will find a specific exapmle on how to evaluate your finetuned model, which can then be extended to any LLM and any dataset.
23
+
24
+
### models/
25
+
This directory consists of examples specific to each model mentioned.
26
+
27
+
### playground_ui/
28
+
This directory consists of an example which demonstrates how you can play around with your LLM through a web interface.
29
+
30
+
## Models
31
+
Below is a list of all the supported models via `BaseModel` class of `xTuring` and their corresponding keys to load them.
32
+
33
+
| Model | Key |
34
+
| -- | -- |
35
+
|Bloom | bloom|
36
+
|Cerebras | cerebras|
37
+
|DistilGPT-2 | distilgpt2|
38
+
|Falcon-7B | falcon|
39
+
|Galactica | galactica|
40
+
|GPT-J | gptj|
41
+
|GPT-2 | gpt2|
42
+
|LlaMA | llama|
43
+
|LlaMA2 | llama2|
44
+
|OPT-1.3B | opt|
45
+
46
+
The above mentioned are the base variants of the LLMs. Below are the templates to get their `LoRA`, `INT8`, `INT8 + LoRA` and `INT4 + LoRA` versions.
47
+
48
+
| Version | Template |
49
+
| -- | -- |
50
+
| LoRA| <model_key>_lora|
51
+
| INT8| <model_key>_int8|
52
+
| INT8 + LoRA| <model_key>_lora_int8|
53
+
54
+
** In order to load any model's __`INT4+LoRA`__ version, you will need to make use of `GenericLoraKbitModel` class from `xturing.models`. Below is how to use it:
55
+
```python
56
+
model = GenericLoraKbitModel('<model_path>')
57
+
```
58
+
The `model_path` can be replaced with you local directory or any HuggingFace library model like `facebook/opt-1.3b`.
0 commit comments