KoichiYasuoka commited on
Commit
7fb99b8
1 Parent(s): aaacd3e

cached_file <- hf_bucket_url

Browse files
Files changed (1) hide show
  1. README.md +5 -5
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.file_utils import hf_bucket_url
54
- c=AutoConfig.from_pretrained(hf_bucket_url(bert,"deprel/config.json"))
55
- d=x(hf_bucket_url(bert,"deprel/pytorch_model.bin"),config=c)
56
- s=AutoConfig.from_pretrained(hf_bucket_url(bert,"tagger/config.json"))
57
- t=x(hf_bucket_url(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)
 
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)