JustinLin610
commited on
Commit
•
b9703c0
1
Parent(s):
80355e0
Update README.md
Browse files
README.md
CHANGED
@@ -42,7 +42,7 @@ After, refer the path to OFA-large to `ckpt_dir`, and prepare an image for the t
|
|
42 |
>>> patch_img = patch_resize_transform(img).unsqueeze(0)
|
43 |
|
44 |
|
45 |
-
|
46 |
>>> model = OFAModel.from_pretrained(ckpt_dir, use_cache=True)
|
47 |
>>> generator = sequence_generator.SequenceGenerator(
|
48 |
tokenizer=tokenizer,
|
@@ -56,7 +56,7 @@ After, refer the path to OFA-large to `ckpt_dir`, and prepare an image for the t
|
|
56 |
>>> gen_output = generator.generate([model], data)
|
57 |
>>> gen = [gen_output[i][0]["tokens"] for i in range(len(gen_output))]
|
58 |
|
59 |
-
|
60 |
>>> model = OFAModel.from_pretrained(ckpt_dir, use_cache=False)
|
61 |
>>> gen = model.generate(inputs, patch_images=patch_img, num_beams=5, no_repeat_ngram_size=3)
|
62 |
|
|
|
42 |
>>> patch_img = patch_resize_transform(img).unsqueeze(0)
|
43 |
|
44 |
|
45 |
+
# using the generator of fairseq version
|
46 |
>>> model = OFAModel.from_pretrained(ckpt_dir, use_cache=True)
|
47 |
>>> generator = sequence_generator.SequenceGenerator(
|
48 |
tokenizer=tokenizer,
|
|
|
56 |
>>> gen_output = generator.generate([model], data)
|
57 |
>>> gen = [gen_output[i][0]["tokens"] for i in range(len(gen_output))]
|
58 |
|
59 |
+
# using the generator of huggingface version
|
60 |
>>> model = OFAModel.from_pretrained(ckpt_dir, use_cache=False)
|
61 |
>>> gen = model.generate(inputs, patch_images=patch_img, num_beams=5, no_repeat_ngram_size=3)
|
62 |
|