Upload folder using huggingface_hub
Browse files- README.md +43 -0
- adapter_config.json +29 -0
- adapter_model.safetensors +3 -0
- added_tokens.json +3 -0
- config.json +53 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +30 -0
- tokenizer.model +3 -0
- tokenizer_config.json +51 -0
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="zhezi12138/logs_ppo_summary/train_assistant_harmless/batch_100")
|
| 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("zhezi12138/logs_ppo_summary/train_assistant_harmless/batch_100")
|
| 39 |
+
model = AutoModelForCausalLMWithValueHead.from_pretrained("zhezi12138/logs_ppo_summary/train_assistant_harmless/batch_100")
|
| 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,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": null,
|
| 4 |
+
"base_model_name_or_path": "../sft/logs_trl/assistant_sft/merged_model",
|
| 5 |
+
"bias": "none",
|
| 6 |
+
"fan_in_fan_out": false,
|
| 7 |
+
"inference_mode": true,
|
| 8 |
+
"init_lora_weights": true,
|
| 9 |
+
"layer_replication": null,
|
| 10 |
+
"layers_pattern": null,
|
| 11 |
+
"layers_to_transform": null,
|
| 12 |
+
"loftq_config": {},
|
| 13 |
+
"lora_alpha": 128,
|
| 14 |
+
"lora_dropout": 0.05,
|
| 15 |
+
"megatron_config": null,
|
| 16 |
+
"megatron_core": "megatron.core",
|
| 17 |
+
"modules_to_save": null,
|
| 18 |
+
"peft_type": "LORA",
|
| 19 |
+
"r": 64,
|
| 20 |
+
"rank_pattern": {},
|
| 21 |
+
"revision": null,
|
| 22 |
+
"target_modules": [
|
| 23 |
+
"v_proj",
|
| 24 |
+
"q_proj"
|
| 25 |
+
],
|
| 26 |
+
"task_type": "CAUSAL_LM",
|
| 27 |
+
"use_dora": false,
|
| 28 |
+
"use_rslora": false
|
| 29 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:03a6bf991da4fb0f0be5f9164c698b99346e68782a40ed301a52e1ae35e27028
|
| 3 |
+
size 134235048
|
added_tokens.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"[PAD]": 32000
|
| 3 |
+
}
|
config.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"accelerator_kwargs": {},
|
| 3 |
+
"adap_kl_ctrl": true,
|
| 4 |
+
"backward_batch_size": 1,
|
| 5 |
+
"batch_size": 64,
|
| 6 |
+
"cliprange": 0.2,
|
| 7 |
+
"cliprange_value": 0.2,
|
| 8 |
+
"compare_steps": 1,
|
| 9 |
+
"early_stopping": true,
|
| 10 |
+
"exp_name": "ppo",
|
| 11 |
+
"forward_batch_size": null,
|
| 12 |
+
"gamma": 1,
|
| 13 |
+
"global_backward_batch_size": 4,
|
| 14 |
+
"global_batch_size": 256,
|
| 15 |
+
"gradient_accumulation_steps": 1,
|
| 16 |
+
"horizon": 10000,
|
| 17 |
+
"init_kl_coef": 0.2,
|
| 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": "wandb",
|
| 24 |
+
"max_grad_norm": 0.5,
|
| 25 |
+
"mini_batch_size": 1,
|
| 26 |
+
"model_name": "../sft/logs_trl/assistant_sft/merged_model",
|
| 27 |
+
"optimize_cuda_cache": true,
|
| 28 |
+
"optimize_device_cache": false,
|
| 29 |
+
"ppo_epochs": 4,
|
| 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": 20000,
|
| 39 |
+
"target": 3,
|
| 40 |
+
"target_kl": 1,
|
| 41 |
+
"task_name": null,
|
| 42 |
+
"tracker_kwargs": {
|
| 43 |
+
"wandb": {
|
| 44 |
+
"name": "train_assistant_harmless"
|
| 45 |
+
}
|
| 46 |
+
},
|
| 47 |
+
"tracker_project_name": "ppo",
|
| 48 |
+
"use_score_norm": false,
|
| 49 |
+
"use_score_scaling": false,
|
| 50 |
+
"vf_coef": 0.1,
|
| 51 |
+
"whiten_rewards": false,
|
| 52 |
+
"world_size": 4
|
| 53 |
+
}
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:65308eb2e77be1f6ffbbcc8d804b1ff393da7a996633b8fe21277df0f6ee7b8a
|
| 3 |
+
size 17916
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "[PAD]",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
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,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": true,
|
| 5 |
+
"added_tokens_decoder": {
|
| 6 |
+
"0": {
|
| 7 |
+
"content": "<unk>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": true
|
| 29 |
+
},
|
| 30 |
+
"32000": {
|
| 31 |
+
"content": "[PAD]",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false,
|
| 36 |
+
"special": true
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
"bos_token": "<s>",
|
| 40 |
+
"clean_up_tokenization_spaces": false,
|
| 41 |
+
"eos_token": "</s>",
|
| 42 |
+
"legacy": false,
|
| 43 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 44 |
+
"pad_token": "[PAD]",
|
| 45 |
+
"padding_side": "right",
|
| 46 |
+
"sp_model_kwargs": {},
|
| 47 |
+
"spaces_between_special_tokens": false,
|
| 48 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 49 |
+
"unk_token": "<unk>",
|
| 50 |
+
"use_default_system_prompt": false
|
| 51 |
+
}
|