anirvankrishna commited on
Commit
30055e4
·
verified ·
1 Parent(s): f47b2fc

Upload 6 files

Browse files
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="anirvankrishna/PPO/prefix_tuning/best_model")
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("anirvankrishna/PPO/prefix_tuning/best_model")
39
+ model = AutoModelForCausalLMWithValueHead.from_pretrained("anirvankrishna/PPO/prefix_tuning/best_model")
40
+
41
+ inputs = tokenizer("Hello, my llama is cute", return_tensors="pt")
42
+ outputs = model(**inputs, labels=inputs["input_ids"])
43
+ ```
adapter_config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "auto_mapping": null,
3
+ "base_model_name_or_path": "openai-community/gpt2-medium",
4
+ "encoder_hidden_size": 1024,
5
+ "inference_mode": true,
6
+ "modules_to_save": null,
7
+ "num_attention_heads": 16,
8
+ "num_layers": 24,
9
+ "num_transformer_submodules": 1,
10
+ "num_virtual_tokens": 10,
11
+ "peft_type": "PREFIX_TUNING",
12
+ "peft_version": "0.18.1",
13
+ "prefix_projection": false,
14
+ "revision": null,
15
+ "task_type": "CAUSAL_LM",
16
+ "token_dim": 1024
17
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:016cca9f07cd111480fa8e706c0fc130f54028c519dbd4d74864a6e27c1e9ba7
3
+ size 1966208
config.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "accelerator_kwargs": {},
3
+ "adap_kl_ctrl": true,
4
+ "backward_batch_size": 32,
5
+ "batch_size": 32,
6
+ "cliprange": 0.2,
7
+ "cliprange_value": 0.2,
8
+ "compare_steps": 1,
9
+ "early_stopping": false,
10
+ "exp_name": "colab_kernel_launcher",
11
+ "forward_batch_size": null,
12
+ "gamma": 1,
13
+ "global_backward_batch_size": 32,
14
+ "global_batch_size": 32,
15
+ "gradient_accumulation_steps": 1,
16
+ "horizon": 10000,
17
+ "init_kl_coef": 0.1,
18
+ "is_encoder_decoder": false,
19
+ "is_peft_model": true,
20
+ "kl_penalty": "kl",
21
+ "lam": 0.95,
22
+ "learning_rate": 0.0001,
23
+ "log_with": null,
24
+ "max_grad_norm": null,
25
+ "mini_batch_size": 32,
26
+ "model_name": "gpt2",
27
+ "optimize_cuda_cache": true,
28
+ "optimize_device_cache": false,
29
+ "ppo_epochs": 1,
30
+ "project_kwargs": {},
31
+ "push_to_hub_if_best_kwargs": {},
32
+ "query_dataset": "imdb",
33
+ "ratio_threshold": 10.0,
34
+ "remove_unused_columns": true,
35
+ "reward_model": "sentiment-analysis:lvwerra/distilbert-imdb",
36
+ "score_clip": null,
37
+ "seed": 0,
38
+ "steps": 10,
39
+ "target": 0.1,
40
+ "target_kl": 1,
41
+ "task_name": null,
42
+ "tracker_kwargs": {},
43
+ "tracker_project_name": "trl",
44
+ "use_score_norm": false,
45
+ "use_score_scaling": false,
46
+ "vf_coef": 0.1,
47
+ "whiten_rewards": false,
48
+ "world_size": 1
49
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d296d8763f5ef2e38958c1ec2228c39025c4700fcf5c1a879da051c7a4844ce
3
+ size 6037
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff