vincentmin
commited on
Commit
•
5c1b06c
1
Parent(s):
0e27d94
Push model using huggingface_hub.
Browse files- README.md +42 -0
- adapter_config.json +18 -0
- adapter_model.bin +3 -0
- merges.txt +0 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +24 -0
- tokenizer.json +0 -0
- tokenizer_config.json +40 -0
- vocab.json +0 -0
README.md
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- trl
|
5 |
+
- transformers
|
6 |
+
- reinforcement-learning
|
7 |
+
---
|
8 |
+
|
9 |
+
# TRL Model
|
10 |
+
|
11 |
+
This is a [TRL language model](https://github.com/lvwerra/trl) that has been fine-tuned with reinforcement learning to
|
12 |
+
guide the model outputs according to a value, function, or human feedback. The model can be used for text generation.
|
13 |
+
|
14 |
+
## Usage
|
15 |
+
|
16 |
+
To use this model for inference, first install the TRL library:
|
17 |
+
|
18 |
+
```bash
|
19 |
+
python -m pip install trl
|
20 |
+
```
|
21 |
+
|
22 |
+
You can then generate text as follows:
|
23 |
+
|
24 |
+
```python
|
25 |
+
from transformers import pipeline
|
26 |
+
|
27 |
+
generator = pipeline("text-generation", model="vincentmin//tmp/tmp_mpm7q96/vincentmin/opt-125m-eli5-rl-finetune-128-8-8-1.4e-5_ada")
|
28 |
+
outputs = generator("Hello, my llama is cute")
|
29 |
+
```
|
30 |
+
|
31 |
+
If you want to use the model for training or to obtain the outputs from the value head, load the model as follows:
|
32 |
+
|
33 |
+
```python
|
34 |
+
from transformers import AutoTokenizer
|
35 |
+
from trl import AutoModelForCausalLMWithValueHead
|
36 |
+
|
37 |
+
tokenizer = AutoTokenizer.from_pretrained("vincentmin//tmp/tmp_mpm7q96/vincentmin/opt-125m-eli5-rl-finetune-128-8-8-1.4e-5_ada")
|
38 |
+
model = AutoModelForCausalLMWithValueHead.from_pretrained("vincentmin//tmp/tmp_mpm7q96/vincentmin/opt-125m-eli5-rl-finetune-128-8-8-1.4e-5_ada")
|
39 |
+
|
40 |
+
inputs = tokenizer("Hello, my llama is cute", return_tensors="pt")
|
41 |
+
outputs = model(**inputs, labels=inputs["input_ids"])
|
42 |
+
```
|
adapter_config.json
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"base_model_name_or_path": "vincentmin/opt-125m-eli5",
|
3 |
+
"bias": "none",
|
4 |
+
"enable_lora": null,
|
5 |
+
"fan_in_fan_out": false,
|
6 |
+
"inference_mode": true,
|
7 |
+
"lora_alpha": 32,
|
8 |
+
"lora_dropout": 0.05,
|
9 |
+
"merge_weights": false,
|
10 |
+
"modules_to_save": null,
|
11 |
+
"peft_type": "LORA",
|
12 |
+
"r": 16,
|
13 |
+
"target_modules": [
|
14 |
+
"q_proj",
|
15 |
+
"v_proj"
|
16 |
+
],
|
17 |
+
"task_type": "CAUSAL_LM"
|
18 |
+
}
|
adapter_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:36c8f020942884e1ffce8d1b6f65be184265b6af8aa79f1e111978eb43039f95
|
3 |
+
size 2376641
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ba5eff8a67410d4bf59d2eee3cfa1f15c31b09c965242f2295b07357d2a84447
|
3 |
+
size 4159
|
special_tokens_map.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "</s>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": true,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "</s>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": true,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": "</s>",
|
17 |
+
"unk_token": {
|
18 |
+
"content": "</s>",
|
19 |
+
"lstrip": false,
|
20 |
+
"normalized": true,
|
21 |
+
"rstrip": false,
|
22 |
+
"single_word": false
|
23 |
+
}
|
24 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_prefix_space": false,
|
4 |
+
"bos_token": {
|
5 |
+
"__type": "AddedToken",
|
6 |
+
"content": "</s>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": true,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false
|
11 |
+
},
|
12 |
+
"eos_token": {
|
13 |
+
"__type": "AddedToken",
|
14 |
+
"content": "</s>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": true,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false
|
19 |
+
},
|
20 |
+
"errors": "replace",
|
21 |
+
"model_max_length": 1000000000000000019884624838656,
|
22 |
+
"pad_token": {
|
23 |
+
"__type": "AddedToken",
|
24 |
+
"content": "<pad>",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": true,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
},
|
30 |
+
"special_tokens_map_file": null,
|
31 |
+
"tokenizer_class": "GPT2Tokenizer",
|
32 |
+
"unk_token": {
|
33 |
+
"__type": "AddedToken",
|
34 |
+
"content": "</s>",
|
35 |
+
"lstrip": false,
|
36 |
+
"normalized": true,
|
37 |
+
"rstrip": false,
|
38 |
+
"single_word": false
|
39 |
+
}
|
40 |
+
}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|