add model
Browse files- README.md +42 -0
- adapter_config.json +18 -0
- adapter_model.bin +3 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +6 -0
- tokenizer.model +3 -0
- tokenizer_config.json +8 -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="lvwerra/runs_truncate/step_350")
|
| 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("lvwerra/runs_truncate/step_350")
|
| 38 |
+
model = AutoModelForCausalLMWithValueHead.from_pretrained("lvwerra/runs_truncate/step_350")
|
| 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": "trl-lib/llama-se-merged",
|
| 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:e90eae24a9d0992ff9271c648d5a2a07ba2b4f23877da1a2ae70f4635afcc1dd
|
| 3 |
+
size 33600461
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:84ef5d11766acdf820ca5f23eb77373b3091c105845d69b8821af40581ca9c69
|
| 3 |
+
size 17471
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": "</s>",
|
| 3 |
+
"eos_token": "</s>",
|
| 4 |
+
"pad_token": "[PAD]",
|
| 5 |
+
"unk_token": "</s>"
|
| 6 |
+
}
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
| 3 |
+
size 499723
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": "",
|
| 3 |
+
"eos_token": "",
|
| 4 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 5 |
+
"special_tokens_map_file": "/home/sgugger/tmp/llama/llama-7b-tmp/tokenizer/special_tokens_map.json",
|
| 6 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 7 |
+
"unk_token": ""
|
| 8 |
+
}
|