KoichiYasuoka commited on
Commit
d4f3736
1 Parent(s): c8b64c4

cached_file <- hf_bucket_url

Browse files
Files changed (1) hide show
  1. README.md +5 -5
README.md CHANGED
@@ -48,11 +48,11 @@ class TransformersUD(object):
48
  if os.path.isdir(bert):
49
  d,t=x(os.path.join(bert,"deprel")),x(os.path.join(bert,"tagger"))
50
  else:
51
- from transformers.file_utils import hf_bucket_url
52
- c=AutoConfig.from_pretrained(hf_bucket_url(bert,"deprel/config.json"))
53
- d=x(hf_bucket_url(bert,"deprel/pytorch_model.bin"),config=c)
54
- s=AutoConfig.from_pretrained(hf_bucket_url(bert,"tagger/config.json"))
55
- t=x(hf_bucket_url(bert,"tagger/pytorch_model.bin"),config=s)
56
  self.deprel=TokenClassificationPipeline(model=d,tokenizer=self.tokenizer,
57
  aggregation_strategy="simple")
58
  self.tagger=TokenClassificationPipeline(model=t,tokenizer=self.tokenizer)
 
48
  if os.path.isdir(bert):
49
  d,t=x(os.path.join(bert,"deprel")),x(os.path.join(bert,"tagger"))
50
  else:
51
+ from transformers.utils import cached_file
52
+ c=AutoConfig.from_pretrained(cached_file(bert,"deprel/config.json"))
53
+ d=x(cached_file(bert,"deprel/pytorch_model.bin"),config=c)
54
+ s=AutoConfig.from_pretrained(cached_file(bert,"tagger/config.json"))
55
+ t=x(cached_file(bert,"tagger/pytorch_model.bin"),config=s)
56
  self.deprel=TokenClassificationPipeline(model=d,tokenizer=self.tokenizer,
57
  aggregation_strategy="simple")
58
  self.tagger=TokenClassificationPipeline(model=t,tokenizer=self.tokenizer)