File size: 1,519 Bytes
29d92a8
 
 
 
 
 
 
 
4258dd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3cb312c
 
 
 
4258dd6
 
 
 
 
 
 
3cb312c
 
 
 
 
 
 
 
 
 
 
 
 
4258dd6
 
24b4bf9
 
4258dd6
24b4bf9
 
4258dd6
24b4bf9
 
4258dd6
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
license: mit
datasets:
- Abirate/english_quotes
language:
- en
library_name: adapter-transformers
pipeline_tag: text-generation
---

# Model Card for Model ID

<!-- Provide a quick summary of what the model is/does. -->

This model is a PEFT model based on TurkuNLP/gpt3-finnish-small

## Model Details

### Model Description

<!-- Provide a longer summary of what this model is. -->



- **Model type:** PEFT Model
- **Language(s) (NLP):** EN
- **License:** mit
- **Finetuned from model [optional]:** TurkuNLP/gpt3-finnish-small


## Uses

<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->

### Direct Use
```python
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer

peft_model_id = "Yooko/gpt3-finnish-small-ft-AbirateEN"
config = PeftConfig.from_pretrained(peft_model_id)
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto')
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)

# Load the Lora model
model = PeftModel.from_pretrained(model, peft_model_id)
```
### Downstream Use [optional]

```python
batch = tokenizer("Two things are infinite: ", return_tensors='pt')

with torch.cuda.amp.autocast():
  output_tokens = model.generate(**batch, max_new_tokens=50)

print('\n\n', tokenizer.decode(output_tokens[0], skip_special_tokens=True))
```