KoichiYasuoka
commited on
Commit
•
7fb99b8
1
Parent(s):
aaacd3e
cached_file <- hf_bucket_url
Browse files
README.md
CHANGED
@@ -50,11 +50,11 @@ class TransformersUD(object):
|
|
50 |
if os.path.isdir(bert):
|
51 |
d,t=x(os.path.join(bert,"deprel")),x(os.path.join(bert,"tagger"))
|
52 |
else:
|
53 |
-
from transformers.
|
54 |
-
c=AutoConfig.from_pretrained(
|
55 |
-
d=x(
|
56 |
-
s=AutoConfig.from_pretrained(
|
57 |
-
t=x(
|
58 |
self.deprel=TokenClassificationPipeline(model=d,tokenizer=self.tokenizer,
|
59 |
aggregation_strategy="simple")
|
60 |
self.tagger=TokenClassificationPipeline(model=t,tokenizer=self.tokenizer)
|
|
|
50 |
if os.path.isdir(bert):
|
51 |
d,t=x(os.path.join(bert,"deprel")),x(os.path.join(bert,"tagger"))
|
52 |
else:
|
53 |
+
from transformers.utils import cached_file
|
54 |
+
c=AutoConfig.from_pretrained(cached_file(bert,"deprel/config.json"))
|
55 |
+
d=x(cached_file(bert,"deprel/pytorch_model.bin"),config=c)
|
56 |
+
s=AutoConfig.from_pretrained(cached_file(bert,"tagger/config.json"))
|
57 |
+
t=x(cached_file(bert,"tagger/pytorch_model.bin"),config=s)
|
58 |
self.deprel=TokenClassificationPipeline(model=d,tokenizer=self.tokenizer,
|
59 |
aggregation_strategy="simple")
|
60 |
self.tagger=TokenClassificationPipeline(model=t,tokenizer=self.tokenizer)
|