Update README.md
Browse files
README.md
CHANGED
@@ -36,11 +36,18 @@ generated_ids = model.generate(
|
|
36 |
)
|
37 |
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
38 |
|
|
|
39 |
processed_text = processor.post_processor_generation(generated_text, cleanup_and_extract=False)
|
|
|
40 |
print(processed_text)
|
|
|
41 |
|
|
|
42 |
processed_text, entities = processor.post_processor_generation(generated_text)
|
|
|
43 |
print(processed_text)
|
|
|
|
|
44 |
print(entities)
|
|
|
45 |
```
|
46 |
-
|
|
|
36 |
)
|
37 |
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
38 |
|
39 |
+
# Specify `cleanup_and_extract=False` in order to see the raw model generation.
|
40 |
processed_text = processor.post_processor_generation(generated_text, cleanup_and_extract=False)
|
41 |
+
|
42 |
print(processed_text)
|
43 |
+
# `An image of a snowman<patch_index_0044><patch_index_0863> warming himself by a fire<patch_index_0005><patch_index_0911>.`
|
44 |
|
45 |
+
# By default, the generated text is cleanup and the entities are extracted.
|
46 |
processed_text, entities = processor.post_processor_generation(generated_text)
|
47 |
+
|
48 |
print(processed_text)
|
49 |
+
# `An image of a snowman warming himself by a fire.`
|
50 |
+
|
51 |
print(entities)
|
52 |
+
# `[('a snowman', (12, 21), [(0.390625, 0.046875, 0.984375, 0.828125)]), ('a fire', (41, 47), [(0.171875, 0.015625, 0.484375, 0.890625)])]`
|
53 |
```
|
|