Push model using huggingface_hub.
Browse files- .gitattributes +1 -0
- README.md +43 -0
- adapter_config.json +28 -0
- adapter_model.safetensors +3 -0
- config.json +51 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +24 -0
- tokenizer.json +3 -0
- tokenizer.model +3 -0
- tokenizer_config.json +50 -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="DarshanDeshpande//tmp/SLURM_20252742/tmp8za0h0al/DarshanDeshpande/gemma_2b_oasst1_ppo_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("DarshanDeshpande//tmp/SLURM_20252742/tmp8za0h0al/DarshanDeshpande/gemma_2b_oasst1_ppo_model")
|
| 39 |
+
model = AutoModelForCausalLMWithValueHead.from_pretrained("DarshanDeshpande//tmp/SLURM_20252742/tmp8za0h0al/DarshanDeshpande/gemma_2b_oasst1_ppo_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,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": null,
|
| 4 |
+
"base_model_name_or_path": "google/gemma-2b",
|
| 5 |
+
"bias": "none",
|
| 6 |
+
"fan_in_fan_out": false,
|
| 7 |
+
"inference_mode": true,
|
| 8 |
+
"init_lora_weights": true,
|
| 9 |
+
"layers_pattern": null,
|
| 10 |
+
"layers_to_transform": null,
|
| 11 |
+
"loftq_config": {},
|
| 12 |
+
"lora_alpha": 8,
|
| 13 |
+
"lora_dropout": 0.05,
|
| 14 |
+
"megatron_config": null,
|
| 15 |
+
"megatron_core": "megatron.core",
|
| 16 |
+
"modules_to_save": null,
|
| 17 |
+
"peft_type": "LORA",
|
| 18 |
+
"r": 8,
|
| 19 |
+
"rank_pattern": {},
|
| 20 |
+
"revision": null,
|
| 21 |
+
"target_modules": [
|
| 22 |
+
"q_proj",
|
| 23 |
+
"v_proj"
|
| 24 |
+
],
|
| 25 |
+
"task_type": "CAUSAL_LM",
|
| 26 |
+
"use_dora": false,
|
| 27 |
+
"use_rslora": false
|
| 28 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2690fbb25dd45c0050b9248acd6807fa880eabf4c656cf137058b1891a5e2f17
|
| 3 |
+
size 3695848
|
config.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"exp_name": "train_ppo",
|
| 3 |
+
"seed": 0,
|
| 4 |
+
"log_with": "wandb",
|
| 5 |
+
"task_name": null,
|
| 6 |
+
"model_name": "google/gemma-2b",
|
| 7 |
+
"query_dataset": "imdb",
|
| 8 |
+
"reward_model": "sentiment-analysis:lvwerra/distilbert-imdb",
|
| 9 |
+
"remove_unused_columns": true,
|
| 10 |
+
"tracker_kwargs": {},
|
| 11 |
+
"accelerator_kwargs": {},
|
| 12 |
+
"project_kwargs": {},
|
| 13 |
+
"tracker_project_name": "trl",
|
| 14 |
+
"push_to_hub_if_best_kwargs": {
|
| 15 |
+
"repo_id": "gemma_2b_oasst1_ppo_model"
|
| 16 |
+
},
|
| 17 |
+
"steps": 20000,
|
| 18 |
+
"learning_rate": 1e-05,
|
| 19 |
+
"adap_kl_ctrl": true,
|
| 20 |
+
"init_kl_coef": 0.2,
|
| 21 |
+
"kl_penalty": "kl",
|
| 22 |
+
"target": 6,
|
| 23 |
+
"horizon": 10000,
|
| 24 |
+
"gamma": 1,
|
| 25 |
+
"lam": 0.95,
|
| 26 |
+
"cliprange": 0.2,
|
| 27 |
+
"cliprange_value": 0.2,
|
| 28 |
+
"vf_coef": 0.1,
|
| 29 |
+
"batch_size": 16,
|
| 30 |
+
"forward_batch_size": null,
|
| 31 |
+
"mini_batch_size": 16,
|
| 32 |
+
"gradient_accumulation_steps": 1,
|
| 33 |
+
"world_size": 1,
|
| 34 |
+
"ppo_epochs": 1,
|
| 35 |
+
"max_grad_norm": null,
|
| 36 |
+
"optimize_cuda_cache": null,
|
| 37 |
+
"optimize_device_cache": false,
|
| 38 |
+
"early_stopping": true,
|
| 39 |
+
"target_kl": 1,
|
| 40 |
+
"compare_steps": 150,
|
| 41 |
+
"ratio_threshold": 10.0,
|
| 42 |
+
"use_score_scaling": false,
|
| 43 |
+
"use_score_norm": false,
|
| 44 |
+
"score_clip": null,
|
| 45 |
+
"whiten_rewards": false,
|
| 46 |
+
"is_encoder_decoder": false,
|
| 47 |
+
"is_peft_model": true,
|
| 48 |
+
"backward_batch_size": 16,
|
| 49 |
+
"global_backward_batch_size": 16,
|
| 50 |
+
"global_batch_size": 16
|
| 51 |
+
}
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dec772d4057432c43b26ec4d65232d7b68e31d3d3bc90c6d869ebda70fdf27f7
|
| 3 |
+
size 9724
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<bos>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "<eos>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": "<eos>",
|
| 17 |
+
"unk_token": {
|
| 18 |
+
"content": "<unk>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
}
|
| 24 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f8c522c5ffd79521e8fce682339b49d021fc234083c15bd26ff497e5e7de803a
|
| 3 |
+
size 17477817
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:61a7b147390c64585d6c3543dd6fc636906c9af3865a5548f27f31aee1d4c8e2
|
| 3 |
+
size 4241003
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"0": {
|
| 6 |
+
"content": "<pad>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"1": {
|
| 14 |
+
"content": "<eos>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"2": {
|
| 22 |
+
"content": "<bos>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"3": {
|
| 30 |
+
"content": "<unk>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
"bos_token": "<bos>",
|
| 39 |
+
"clean_up_tokenization_spaces": false,
|
| 40 |
+
"eos_token": "<eos>",
|
| 41 |
+
"legacy": null,
|
| 42 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 43 |
+
"pad_token": "<eos>",
|
| 44 |
+
"padding_side": "left",
|
| 45 |
+
"sp_model_kwargs": {},
|
| 46 |
+
"spaces_between_special_tokens": false,
|
| 47 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 48 |
+
"unk_token": "<unk>",
|
| 49 |
+
"use_default_system_prompt": false
|
| 50 |
+
}
|