robinsmits
commited on
Commit
•
7bdfdf1
1
Parent(s):
e9183f7
Update README.md
Browse files
README.md
CHANGED
@@ -9,6 +9,7 @@ pipeline_tag: text-generation
|
|
9 |
tags:
|
10 |
- llama
|
11 |
- alpaca
|
|
|
12 |
---
|
13 |
|
14 |
# open_llama_7b_alpaca_clean_dutch_qlora
|
@@ -19,6 +20,34 @@ This adapter model is a fine-tuned version of [openlm-research/open_llama_7b](ht
|
|
19 |
|
20 |
See [openlm-research/open_llama_7b](https://huggingface.co/openlm-research/open_llama_7b) for all information about the base model.
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
## Intended uses & limitations
|
23 |
|
24 |
The open_llama_7b model was primarily trained on the English language. Part of the dataset was a Wikipedia dump containing pages in 20 languages.
|
|
|
9 |
tags:
|
10 |
- llama
|
11 |
- alpaca
|
12 |
+
- Transformers
|
13 |
---
|
14 |
|
15 |
# open_llama_7b_alpaca_clean_dutch_qlora
|
|
|
20 |
|
21 |
See [openlm-research/open_llama_7b](https://huggingface.co/openlm-research/open_llama_7b) for all information about the base model.
|
22 |
|
23 |
+
## Model usage
|
24 |
+
|
25 |
+
A basic example of how to use the finetuned model.
|
26 |
+
|
27 |
+
```
|
28 |
+
import torch
|
29 |
+
from peft import PeftModel, PeftConfig
|
30 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
31 |
+
|
32 |
+
model_name = "robinsmits/open_llama_7b_alpaca_clean_dutch_qlora"
|
33 |
+
|
34 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast = False, add_eos_token = True)
|
35 |
+
|
36 |
+
config = PeftConfig.from_pretrained(model_name)
|
37 |
+
|
38 |
+
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, load_in_8bit = True, device_map = "auto")
|
39 |
+
model = PeftModel.from_pretrained(model, model_name)
|
40 |
+
|
41 |
+
prompt = "### Instructie:\nWat zijn de drie belangrijkste softwareonderdelen die worden gebruikt bij webontwikkeling?\n\n### Antwoord:\n"
|
42 |
+
|
43 |
+
inputs = tokenizer(prompt, return_tensors = "pt", truncation = True).input_ids.cuda()
|
44 |
+
sample = model.generate(input_ids = inputs, max_new_tokens = 512, num_beams = 2, early_stopping = True, eos_token_id = tokenizer.eos_token_id)
|
45 |
+
output = tokenizer.decode(sample[0], skip_special_tokens = True)
|
46 |
+
|
47 |
+
print(output.split(prompt)[1])
|
48 |
+
```
|
49 |
+
For more extensive usage and a lot of generated samples (both good and bad samples) see the following [Inference Notebook](https://github.com/RobinSmits/Dutch-LLMs/blob/main/Open_Llama_7B_Alpaca_Clean_Dutch_Inference.ipynb)
|
50 |
+
|
51 |
## Intended uses & limitations
|
52 |
|
53 |
The open_llama_7b model was primarily trained on the English language. Part of the dataset was a Wikipedia dump containing pages in 20 languages.
|