@@ -168,11 +168,11 @@ def apply_prefix(task, x):
168
168
imdb_batch_size = 3
169
169
imdb_datapipe = IMDB (split = "test" )
170
170
task = "sst2 sentence"
171
- labels = {"neg " : "negative" , "pos " : "positive" }
171
+ labels = {"1 " : "negative" , "2 " : "positive" }
172
172
173
173
174
174
def process_labels (labels , x ):
175
- return x [1 ], labels [x [0 ]]
175
+ return x [1 ], labels [str ( x [0 ]) ]
176
176
177
177
178
178
imdb_datapipe = imdb_datapipe .map (partial (process_labels , labels ))
@@ -361,7 +361,7 @@ def process_labels(labels, x):
361
361
# really annoying was the constant cuts to VDs daughter during the last fight scene.<br /><br />
362
362
# Not bad. Not good. Passable 4.
363
363
#
364
- # prediction: negative
364
+ # prediction: positive
365
365
#
366
366
# target: negative
367
367
#
@@ -388,13 +388,12 @@ def process_labels(labels, x):
388
388
# ---------------------
389
389
#
390
390
# Finally, we can also use the model to generate English to German translations on the first batch of examples from the Multi30k
391
- # test set using a beam size of 4 .
391
+ # test set.
392
392
#
393
393
394
394
batch = next (iter (multi_dataloader ))
395
395
input_text = batch ["english" ]
396
396
target = batch ["german" ]
397
- beam_size = 4
398
397
399
398
model_input = transform (input_text )
400
399
model_output = sequence_generator .generate (model_input , eos_idx = eos_idx , num_beams = beam_size )
0 commit comments