JustinLin610
commited on
Commit
•
70fbef0
1
Parent(s):
a435fd4
Update README.md
Browse files
README.md
CHANGED
@@ -45,7 +45,7 @@ After, refer the path to OFA-tiny to `ckpt_dir`, and prepare an image for the te
|
|
45 |
>>> patch_img = patch_resize_transform(img).unsqueeze(0)
|
46 |
|
47 |
|
48 |
-
|
49 |
>>> model = OFAModel.from_pretrained(ckpt_dir, use_cache=True)
|
50 |
>>> generator = sequence_generator.SequenceGenerator(
|
51 |
tokenizer=tokenizer,
|
@@ -59,7 +59,7 @@ After, refer the path to OFA-tiny to `ckpt_dir`, and prepare an image for the te
|
|
59 |
>>> gen_output = generator.generate([model], data)
|
60 |
>>> gen = [gen_output[i][0]["tokens"] for i in range(len(gen_output))]
|
61 |
|
62 |
-
|
63 |
>>> model = OFAModel.from_pretrained(ckpt_dir, use_cache=False)
|
64 |
>>> gen = model.generate(inputs, patch_images=patch_img, num_beams=5, no_repeat_ngram_size=3)
|
65 |
|
|
|
45 |
>>> patch_img = patch_resize_transform(img).unsqueeze(0)
|
46 |
|
47 |
|
48 |
+
# using the generator of fairseq version
|
49 |
>>> model = OFAModel.from_pretrained(ckpt_dir, use_cache=True)
|
50 |
>>> generator = sequence_generator.SequenceGenerator(
|
51 |
tokenizer=tokenizer,
|
|
|
59 |
>>> gen_output = generator.generate([model], data)
|
60 |
>>> gen = [gen_output[i][0]["tokens"] for i in range(len(gen_output))]
|
61 |
|
62 |
+
# using the generator of huggingface version
|
63 |
>>> model = OFAModel.from_pretrained(ckpt_dir, use_cache=False)
|
64 |
>>> gen = model.generate(inputs, patch_images=patch_img, num_beams=5, no_repeat_ngram_size=3)
|
65 |
|