Upload with huggingface_hub
#1
by lewtun HF Staff - opened
Files changed (8)
- README.mdAdded+41
- config.jsonAdded+34
- merges.txtAdded
- pytorch_model.binAdded+3
- special_tokens_map.jsonAdded+6
- tokenizer.jsonAdded
- tokenizer_config.jsonAdded+35
- vocab.jsonAdded
1234567891011121314151617181920212223242526272829303132333435363738394041---license: apache-2.0tags:- trl- transformers- reinforcement-learning---
# TRL Model
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.
## Usage
To use this model for inference, first install the TRL library:
```bashpython -m pip install trl```
You can then generate text as follows:
```pythonfrom transformers import pipeline
generator = pipeline("text-generation", model="lewtun/dummy-trl-model")outputs = generator("Hello, my llama is cute")```
If you want to use the model for training or to obtain the outputs from the value head, load the model as follows:
```pythonfrom transformers import AutoTokenizerfrom trl import AutoModelForCausalLMWithValueHead
tokenizer = AutoTokenizer.from_pretrained("lewtun/dummy-trl-model")model = AutoModelForCausalLMWithValueHead.from_pretrained("lewtun/dummy-trl-model")
inputs = tokenizer("Hello, my llama is cute", return_tensors="pt")outputs = model(**inputs, labels=inputs["input_ids"])```12345678910111213141516171819202122232425262728293031323334{ "_name_or_path": "lvwerra/gpt2-imdb", "activation_function": "gelu_new", "architectures": [ "GPT2LMHeadModel" ], "attn_pdrop": 0.1, "bos_token_id": 50256, "embd_pdrop": 0.1, "eos_token_id": 50256, "initializer_range": 0.02, "layer_norm_epsilon": 1e-05, "model_type": "gpt2", "n_ctx": 1024, "n_embd": 768, "n_head": 12, "n_inner": null, "n_layer": 12, "n_positions": 1024, "output_past": true, "reorder_and_upcast_attn": false, "resid_pdrop": 0.1, "scale_attn_by_inverse_layer_idx": false, "scale_attn_weights": true, "summary_activation": null, "summary_first_dropout": 0.1, "summary_proj_to_labels": true, "summary_type": "cls_index", "summary_use_proj": true, "torch_dtype": "float32", "transformers_version": "4.25.1", "use_cache": true, "vocab_size": 50257}123version https://git-lfs.github.com/spec/v1oid sha256:2a2db8f0e1428ef5dcbe39d1f05be117c6cc57fbe0244a4db3ec5c595ec25f9dsize 510399237123456{ "bos_token": "<|endoftext|>", "eos_token": "<|endoftext|>", "pad_token": "<|endoftext|>", "unk_token": "<|endoftext|>"}1234567891011121314151617181920212223242526272829303132333435{ "add_bos_token": false, "add_prefix_space": false, "bos_token": { "__type": "AddedToken", "content": "<|endoftext|>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "eos_token": { "__type": "AddedToken", "content": "<|endoftext|>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "errors": "replace", "max_len": 1024, "model_max_length": 1024, "name_or_path": "lvwerra/gpt2-imdb", "pad_token": null, "special_tokens_map_file": "/Users/lewtun/.cache/huggingface/hub/models--lvwerra--gpt2-imdb/snapshots/f1bfd819c6bee6c18fa5f95bfe88d9198839a435/special_tokens_map.json", "tokenizer_class": "GPT2Tokenizer", "unk_token": { "__type": "AddedToken", "content": "<|endoftext|>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }}README.mdAdded+41
config.jsonAdded+34
merges.txtAdded
pytorch_model.binAdded+3
special_tokens_map.jsonAdded+6
tokenizer.jsonAdded
tokenizer_config.jsonAdded+35
vocab.jsonAdded