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