lewtun HF staff commited on
Commit
54c993e
1 Parent(s): cd3e534
README.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 guide the model outputs according to a value, function, or human feedback. The model can be used for text generation.
12
+
13
+ ## Usage
14
+
15
+ To use this model for inference, first install the TRL library:
16
+
17
+ ```bash
18
+ python -m pip install trl
19
+ ```
20
+
21
+ You can then generate text as follows:
22
+
23
+ ```python
24
+ from transformers import pipeline
25
+
26
+ generator = pipeline("text-generation", model="lewtun/dummy-trl-model")
27
+ outputs = generator("Hello, my llama is cute")
28
+ ```
29
+
30
+ If you want to use the model for training or to obtain the outputs from the value head, load the model as follows:
31
+
32
+ ```python
33
+ from transformers import AutoTokenizer
34
+ from trl import AutoModelForCausalLMWithValueHead
35
+
36
+ tokenizer = AutoTokenizer.from_pretrained("lewtun/dummy-trl-model")
37
+ model = AutoModelForCausalLMWithValueHead.from_pretrained("lewtun/dummy-trl-model")
38
+
39
+ inputs = tokenizer("Hello, my llama is cute", return_tensors="pt")
40
+ outputs = model(**inputs, labels=inputs["input_ids"])
41
+ ```
config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "lvwerra/gpt2-imdb",
3
+ "activation_function": "gelu_new",
4
+ "architectures": [
5
+ "GPT2LMHeadModel"
6
+ ],
7
+ "attn_pdrop": 0.1,
8
+ "bos_token_id": 50256,
9
+ "embd_pdrop": 0.1,
10
+ "eos_token_id": 50256,
11
+ "initializer_range": 0.02,
12
+ "layer_norm_epsilon": 1e-05,
13
+ "model_type": "gpt2",
14
+ "n_ctx": 1024,
15
+ "n_embd": 768,
16
+ "n_head": 12,
17
+ "n_inner": null,
18
+ "n_layer": 12,
19
+ "n_positions": 1024,
20
+ "output_past": true,
21
+ "reorder_and_upcast_attn": false,
22
+ "resid_pdrop": 0.1,
23
+ "scale_attn_by_inverse_layer_idx": false,
24
+ "scale_attn_weights": true,
25
+ "summary_activation": null,
26
+ "summary_first_dropout": 0.1,
27
+ "summary_proj_to_labels": true,
28
+ "summary_type": "cls_index",
29
+ "summary_use_proj": true,
30
+ "torch_dtype": "float32",
31
+ "transformers_version": "4.25.1",
32
+ "use_cache": true,
33
+ "vocab_size": 50257
34
+ }
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:2a2db8f0e1428ef5dcbe39d1f05be117c6cc57fbe0244a4db3ec5c595ec25f9d
3
+ size 510399237
special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<|endoftext|>",
3
+ "eos_token": "<|endoftext|>",
4
+ "pad_token": "<|endoftext|>",
5
+ "unk_token": "<|endoftext|>"
6
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "bos_token": {
5
+ "__type": "AddedToken",
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "eos_token": {
13
+ "__type": "AddedToken",
14
+ "content": "<|endoftext|>",
15
+ "lstrip": false,
16
+ "normalized": true,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ },
20
+ "errors": "replace",
21
+ "max_len": 1024,
22
+ "model_max_length": 1024,
23
+ "name_or_path": "lvwerra/gpt2-imdb",
24
+ "pad_token": null,
25
+ "special_tokens_map_file": "/Users/lewtun/.cache/huggingface/hub/models--lvwerra--gpt2-imdb/snapshots/f1bfd819c6bee6c18fa5f95bfe88d9198839a435/special_tokens_map.json",
26
+ "tokenizer_class": "GPT2Tokenizer",
27
+ "unk_token": {
28
+ "__type": "AddedToken",
29
+ "content": "<|endoftext|>",
30
+ "lstrip": false,
31
+ "normalized": true,
32
+ "rstrip": false,
33
+ "single_word": false
34
+ }
35
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff