Evan-Lin commited on
Commit
aba1e0b
·
1 Parent(s): db83a0a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +1 -42
README.md CHANGED
@@ -1,42 +1 @@
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/lvwerra/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="Evan-Lin//tmp/tmpuz01z58o/Evan-Lin/Bart-Yelp-rougelastbatch-attractive1-keywordmax1-encoderrep0.5-length0-rep0.5")
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("Evan-Lin//tmp/tmpuz01z58o/Evan-Lin/Bart-Yelp-rougelastbatch-attractive1-keywordmax1-encoderrep0.5-length0-rep0.5")
38
- model = AutoModelForCausalLMWithValueHead.from_pretrained("Evan-Lin//tmp/tmpuz01z58o/Evan-Lin/Bart-Yelp-rougelastbatch-attractive1-keywordmax1-encoderrep0.5-length0-rep0.5")
39
-
40
- inputs = tokenizer("Hello, my llama is cute", return_tensors="pt")
41
- outputs = model(**inputs, labels=inputs["input_ids"])
42
- ```
 
1
+ 生很長的句子?