Upload 7 files
Browse files- .gitattributes +1 -0
- README.md +43 -0
- config.json +33 -0
- generation_config.json +7 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +6 -0
- tokenizer.json +3 -0
- tokenizer_config.json +11 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- trl
|
5 |
+
- ppo
|
6 |
+
- transformers
|
7 |
+
- reinforcement-learning
|
8 |
+
---
|
9 |
+
|
10 |
+
# TRL Model
|
11 |
+
|
12 |
+
This is a [TRL language model](https://github.com/huggingface/trl) that has been fine-tuned with reinforcement learning to
|
13 |
+
guide the model outputs according to a value, function, or human feedback. The model can be used for text generation.
|
14 |
+
|
15 |
+
## Usage
|
16 |
+
|
17 |
+
To use this model for inference, first install the TRL library:
|
18 |
+
|
19 |
+
```bash
|
20 |
+
python -m pip install trl
|
21 |
+
```
|
22 |
+
|
23 |
+
You can then generate text as follows:
|
24 |
+
|
25 |
+
```python
|
26 |
+
from transformers import pipeline
|
27 |
+
|
28 |
+
generator = pipeline("text-generation", model="stvnl/ppo_zh_20241030_1202")
|
29 |
+
outputs = generator("Hello, my llama is cute")
|
30 |
+
```
|
31 |
+
|
32 |
+
If you want to use the model for training or to obtain the outputs from the value head, load the model as follows:
|
33 |
+
|
34 |
+
```python
|
35 |
+
from transformers import AutoTokenizer
|
36 |
+
from trl import AutoModelForCausalLMWithValueHead
|
37 |
+
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained("stvnl/ppo_zh_20241030_1202")
|
39 |
+
model = AutoModelForCausalLMWithValueHead.from_pretrained("stvnl/ppo_zh_20241030_1202")
|
40 |
+
|
41 |
+
inputs = tokenizer("Hello, my llama is cute", return_tensors="pt")
|
42 |
+
outputs = model(**inputs, labels=inputs["input_ids"])
|
43 |
+
```
|
config.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "bigscience/bloomz-560m",
|
3 |
+
"apply_residual_connection_post_layernorm": false,
|
4 |
+
"architectures": [
|
5 |
+
"BloomForCausalLM"
|
6 |
+
],
|
7 |
+
"attention_dropout": 0.0,
|
8 |
+
"attention_softmax_in_fp32": true,
|
9 |
+
"bias_dropout_fusion": true,
|
10 |
+
"bos_token_id": 1,
|
11 |
+
"eos_token_id": 2,
|
12 |
+
"hidden_dropout": 0.0,
|
13 |
+
"hidden_size": 1024,
|
14 |
+
"initializer_range": 0.02,
|
15 |
+
"layer_norm_epsilon": 1e-05,
|
16 |
+
"masked_softmax_fusion": true,
|
17 |
+
"model_type": "bloom",
|
18 |
+
"n_head": 16,
|
19 |
+
"n_inner": null,
|
20 |
+
"n_layer": 24,
|
21 |
+
"offset_alibi": 100,
|
22 |
+
"pad_token_id": 3,
|
23 |
+
"pretraining_tp": 1,
|
24 |
+
"seq_length": 2048,
|
25 |
+
"skip_bias_add": true,
|
26 |
+
"skip_bias_add_qkv": false,
|
27 |
+
"slow_but_exact": false,
|
28 |
+
"torch_dtype": "float32",
|
29 |
+
"transformers_version": "4.31.0",
|
30 |
+
"unk_token_id": 0,
|
31 |
+
"use_cache": true,
|
32 |
+
"vocab_size": 250880
|
33 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 1,
|
4 |
+
"eos_token_id": 2,
|
5 |
+
"pad_token_id": 3,
|
6 |
+
"transformers_version": "4.31.0"
|
7 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b7840c88690500b0a57a7daab470f84b178ba6e3df0658852f72f8cc12cbfc0d
|
3 |
+
size 2236962217
|
special_tokens_map.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<s>",
|
3 |
+
"eos_token": "</s>",
|
4 |
+
"pad_token": "</s>",
|
5 |
+
"unk_token": "<unk>"
|
6 |
+
}
|
tokenizer.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:17a208233d2ee8d8c83b23bc214df737c44806a1919f444e89b31e586cd956ba
|
3 |
+
size 14500471
|
tokenizer_config.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"bos_token": "<s>",
|
4 |
+
"clean_up_tokenization_spaces": false,
|
5 |
+
"eos_token": "</s>",
|
6 |
+
"model_max_length": 1000000000000000019884624838656,
|
7 |
+
"pad_token": "<pad>",
|
8 |
+
"padding_side": "left",
|
9 |
+
"tokenizer_class": "BloomTokenizer",
|
10 |
+
"unk_token": "<unk>"
|
11 |
+
}
|