Update README.md
Browse files
README.md
CHANGED
@@ -7,4 +7,39 @@ datasets:
|
|
7 |
tags:
|
8 |
- alpaca
|
9 |
- llama
|
10 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
tags:
|
8 |
- alpaca
|
9 |
- llama
|
10 |
+
---
|
11 |
+
|
12 |
+
This repository contains a LoRA checkpoint based on the Alpaca-LoRA implementation to perform coding tasks better. The provided checkpoint can be used with the `generate.py` script from the Alpaca-LoRA repository to generate text or perform other NLP tasks.
|
13 |
+
|
14 |
+
## Setup
|
15 |
+
|
16 |
+
1. Clone the Alpaca-LoRA repository:
|
17 |
+
|
18 |
+
git clone https://github.com/tloen/alpaca-lora.git
|
19 |
+
3. Install the required packages:
|
20 |
+
|
21 |
+
pip install -r requirements.txt
|
22 |
+
|
23 |
+
|
24 |
+
## Usage
|
25 |
+
|
26 |
+
Use the `generate.py` script from the Alpaca-LoRA repository to run the model with the provided LoRA checkpoint:
|
27 |
+
|
28 |
+
python generate.py --load_8bit --base_model 'decapoda-research/llama-7b-hf' --lora_weights 'vihangd/leet-coding-alpaca-lora'
|
29 |
+
|
30 |
+
### Troubleshooting
|
31 |
+
|
32 |
+
If you encounter an error like:
|
33 |
+
|
34 |
+
AttributeError: 'NoneType' object has no attribute 'device'
|
35 |
+
|
36 |
+
Modify `generate.py` as follows (see [issue #21](https://github.com/tloen/alpaca-lora/issues/21)):
|
37 |
+
|
38 |
+
```python
|
39 |
+
model = PeftModel.from_pretrained(
|
40 |
+
model,
|
41 |
+
lora_weights,
|
42 |
+
torch_dtype=torch.float16,
|
43 |
+
device_map={'': 0}
|
44 |
+
)
|
45 |
+
```
|