anirvankrishna commited on
Commit
1d8a46b
·
verified ·
1 Parent(s): 0a40919

Upload 7 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/qlora/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/qlora/best_model")
39
+ model = AutoModelForCausalLMWithValueHead.from_pretrained("anirvankrishna/PPO/qlora/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,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "openai-community/gpt2-medium",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": true,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 8,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "megatron_config": null,
23
+ "megatron_core": "megatron.core",
24
+ "modules_to_save": null,
25
+ "peft_type": "LORA",
26
+ "peft_version": "0.18.1",
27
+ "qalora_group_size": 16,
28
+ "r": 8,
29
+ "rank_pattern": {},
30
+ "revision": null,
31
+ "target_modules": [
32
+ "c_attn"
33
+ ],
34
+ "target_parameters": null,
35
+ "task_type": "CAUSAL_LM",
36
+ "trainable_token_indices": null,
37
+ "use_dora": false,
38
+ "use_qalora": false,
39
+ "use_rslora": false
40
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff39f95de294c5a6cbd82323611317d1e0278e718beae46996bcda5a1f0379d6
3
+ size 3151856
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.5,
18
+ "is_encoder_decoder": false,
19
+ "is_peft_model": true,
20
+ "kl_penalty": "kl",
21
+ "lam": 0.95,
22
+ "learning_rate": 1e-05,
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:e418640b4bc77f01d6e55b2f9b0929625114ca5d4d621637ae8fd966355d2a55
3
+ size 6037
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|endoftext|>",
5
+ "eos_token": "<|endoftext|>",
6
+ "errors": "replace",
7
+ "is_local": false,
8
+ "model_max_length": 1024,
9
+ "pad_token": "<|endoftext|>",
10
+ "tokenizer_class": "GPT2Tokenizer",
11
+ "unk_token": "<|endoftext|>"
12
+ }