lorenzoscottb commited on
Commit
ca3ab69
·
verified ·
1 Parent(s): 5bd9271

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -5
README.md CHANGED
@@ -23,11 +23,6 @@ should probably proofread and complete it, then remove this comment. -->
23
 
24
  This model is a fine-tuned version of [google-t5/t5-base](https://huggingface.co/google-t5/t5-small) on the annotated [Dreambank.net](https://dreambank.net/) dataset.It achieves the following results on the evaluation set:
25
 
26
-
27
- ## Model description
28
-
29
- More information needed
30
-
31
  ## Intended uses & limitations
32
 
33
  This model is designed for research purposes. See the disclaimer for more details.
@@ -115,6 +110,41 @@ in annotating dream reports for research purposes, as well as detailing their st
115
  - Datasets 3.0.1
116
  - Tokenizers 0.19.1
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  # Dual-Use Implication
119
  Upon evaluation we identified no dual-use implication for the present model
120
 
 
23
 
24
  This model is a fine-tuned version of [google-t5/t5-base](https://huggingface.co/google-t5/t5-small) on the annotated [Dreambank.net](https://dreambank.net/) dataset.It achieves the following results on the evaluation set:
25
 
 
 
 
 
 
26
  ## Intended uses & limitations
27
 
28
  This model is designed for research purposes. See the disclaimer for more details.
 
110
  - Datasets 3.0.1
111
  - Tokenizers 0.19.1
112
 
113
+ # Usage
114
+
115
+ ```python
116
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
117
+
118
+ model_id = "jrc-ai/PreDA-base"
119
+ device = "cpu"
120
+ encoder_max_length = 100
121
+ decoder_max_length = 50
122
+
123
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
124
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
125
+
126
+ dream = "I was talking with my brother about my birthday dinner. I was feeling sad."
127
+ prefixes = ["Emotion", "Activities", "Characters"]
128
+ text_inputs = ["{} : {}".format(p, dream) for p in prefixes]
129
+
130
+ inputs = tokenizer(
131
+ text_inputs,
132
+ max_length=encoder_max_length,
133
+ truncation=True,
134
+ padding=True,
135
+ return_tensors="pt"
136
+ )
137
+
138
+ output = model.generate(
139
+ **inputs.to(device),
140
+ do_sample=False,
141
+ max_length=decoder_max_length,
142
+ )
143
+
144
+ for decode_dream in output:
145
+ print(tokenizer.decode(decode_dream, skip_special_tokens=True))
146
+ ```
147
+
148
  # Dual-Use Implication
149
  Upon evaluation we identified no dual-use implication for the present model
150