amirabdullah19852020
commited on
Commit
•
dde3ed1
1
Parent(s):
9988343
Push model using huggingface_hub.
Browse files- README.md +42 -0
- config.json +29 -0
- generation_config.json +6 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +6 -0
- tokenizer.json +0 -0
- tokenizer_config.json +9 -0
README.md
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- trl
|
5 |
+
- transformers
|
6 |
+
- reinforcement-learning
|
7 |
+
---
|
8 |
+
|
9 |
+
# TRL Model
|
10 |
+
|
11 |
+
This is a [TRL language model](https://github.com/huggingface/trl) that has been fine-tuned with reinforcement learning to
|
12 |
+
guide the model outputs according to a value, function, or human feedback. The model can be used for text generation.
|
13 |
+
|
14 |
+
## Usage
|
15 |
+
|
16 |
+
To use this model for inference, first install the TRL library:
|
17 |
+
|
18 |
+
```bash
|
19 |
+
python -m pip install trl
|
20 |
+
```
|
21 |
+
|
22 |
+
You can then generate text as follows:
|
23 |
+
|
24 |
+
```python
|
25 |
+
from transformers import pipeline
|
26 |
+
|
27 |
+
generator = pipeline("text-generation", model="amirabdullah19852020//tmp/tmp0swqw55a/amirabdullah19852020/pythia-160m_sentiment_reward")
|
28 |
+
outputs = generator("Hello, my llama is cute")
|
29 |
+
```
|
30 |
+
|
31 |
+
If you want to use the model for training or to obtain the outputs from the value head, load the model as follows:
|
32 |
+
|
33 |
+
```python
|
34 |
+
from transformers import AutoTokenizer
|
35 |
+
from trl import AutoModelForCausalLMWithValueHead
|
36 |
+
|
37 |
+
tokenizer = AutoTokenizer.from_pretrained("amirabdullah19852020//tmp/tmp0swqw55a/amirabdullah19852020/pythia-160m_sentiment_reward")
|
38 |
+
model = AutoModelForCausalLMWithValueHead.from_pretrained("amirabdullah19852020//tmp/tmp0swqw55a/amirabdullah19852020/pythia-160m_sentiment_reward")
|
39 |
+
|
40 |
+
inputs = tokenizer("Hello, my llama is cute", return_tensors="pt")
|
41 |
+
outputs = model(**inputs, labels=inputs["input_ids"])
|
42 |
+
```
|
config.json
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "EleutherAI/pythia-160m",
|
3 |
+
"architectures": [
|
4 |
+
"GPTNeoXForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 0,
|
8 |
+
"classifier_dropout": 0.1,
|
9 |
+
"eos_token_id": 0,
|
10 |
+
"hidden_act": "gelu",
|
11 |
+
"hidden_dropout": 0.0,
|
12 |
+
"hidden_size": 768,
|
13 |
+
"initializer_range": 0.02,
|
14 |
+
"intermediate_size": 3072,
|
15 |
+
"layer_norm_eps": 1e-05,
|
16 |
+
"max_position_embeddings": 2048,
|
17 |
+
"model_type": "gpt_neox",
|
18 |
+
"num_attention_heads": 12,
|
19 |
+
"num_hidden_layers": 12,
|
20 |
+
"rope_scaling": null,
|
21 |
+
"rotary_emb_base": 10000,
|
22 |
+
"rotary_pct": 0.25,
|
23 |
+
"tie_word_embeddings": false,
|
24 |
+
"torch_dtype": "float32",
|
25 |
+
"transformers_version": "4.32.1",
|
26 |
+
"use_cache": true,
|
27 |
+
"use_parallel_residual": true,
|
28 |
+
"vocab_size": 50304
|
29 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 0,
|
4 |
+
"eos_token_id": 0,
|
5 |
+
"transformers_version": "4.32.1"
|
6 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fa9bd34a2dbb48702bcbbf4806e1848b366c8aed746177ea04b10edd16dbec22
|
3 |
+
size 649349269
|
special_tokens_map.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<|endoftext|>",
|
3 |
+
"eos_token": "<|endoftext|>",
|
4 |
+
"pad_token": "<|endoftext|>",
|
5 |
+
"unk_token": "<|endoftext|>"
|
6 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"bos_token": "<|endoftext|>",
|
4 |
+
"clean_up_tokenization_spaces": true,
|
5 |
+
"eos_token": "<|endoftext|>",
|
6 |
+
"model_max_length": 1000000000000000019884624838656,
|
7 |
+
"tokenizer_class": "GPTNeoXTokenizer",
|
8 |
+
"unk_token": "<|endoftext|>"
|
9 |
+
}
|