Skip to content

Commit fc4803b

Browse files
authored
fix example in README.md (#509)
fixes #416
1 parent a78b3ef commit fc4803b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ from pytorch_ie import PyTorchIEPipeline
378378
from pytorch_ie.core import AnnotationLayer, annotation_field
379379
from pytorch_ie.annotations import BinaryRelation, LabeledSpan
380380
from pytorch_ie.documents import TextDocument
381+
# all models and taskmodules are registered and can be loaded via the Auto classes
382+
from pytorch_ie.models import *
383+
from pytorch_ie.taskmodules import *
381384

382385

383386
@dataclass
@@ -390,7 +393,11 @@ document = ExampleDocument(
390393
"“Making a super tasty alt-chicken wing is only half of it,” said Po Bronson, general partner at SOSV and managing director of IndieBio."
391394
)
392395

393-
re_pipeline = PyTorchIEPipeline.from_pretrained("pie/example-re-textclf-tacred", device=-1, num_workers=0)
396+
re_pipeline = PyTorchIEPipeline.from_pretrained(
397+
"pie/example-re-textclf-tacred",
398+
taskmodule_kwargs=dict(create_relation_candidates=True),
399+
device="cpu",
400+
)
394401

395402
for start, end, label in [(65, 75, "PER"), (96, 100, "ORG"), (126, 134, "ORG")]:
396403
document.entities.append(LabeledSpan(start=start, end=end, label=label))

0 commit comments

Comments
 (0)