Spaces:
Runtime error
Runtime error
nguyenvulebinh
commited on
Commit
•
66f50a6
1
Parent(s):
f7a0231
Update model_handling.py
Browse files- model_handling.py +6 -4
model_handling.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
from transformers.file_utils import cached_path, hf_bucket_url
|
|
|
2 |
from importlib.machinery import SourceFileLoader
|
3 |
import os
|
4 |
from transformers import EncoderDecoderModel, AutoConfig, AutoModel, EncoderDecoderConfig, RobertaForCausalLM, \
|
@@ -711,9 +712,10 @@ def download_tokenizer_files():
|
|
711 |
resources = ['envibert_tokenizer.py', 'dict.txt', 'sentencepiece.bpe.model']
|
712 |
for item in resources:
|
713 |
if not os.path.exists(os.path.join(cache_dir, item)):
|
714 |
-
|
715 |
-
tmp_file =
|
716 |
-
|
|
|
717 |
|
718 |
|
719 |
def init_tokenizer():
|
|
|
1 |
+
# from transformers.file_utils import cached_path, hf_bucket_url
|
2 |
+
from huggingface_hub import hf_hub_download
|
3 |
from importlib.machinery import SourceFileLoader
|
4 |
import os
|
5 |
from transformers import EncoderDecoderModel, AutoConfig, AutoModel, EncoderDecoderConfig, RobertaForCausalLM, \
|
|
|
712 |
resources = ['envibert_tokenizer.py', 'dict.txt', 'sentencepiece.bpe.model']
|
713 |
for item in resources:
|
714 |
if not os.path.exists(os.path.join(cache_dir, item)):
|
715 |
+
hf_hub_download(model_name, filename=item)
|
716 |
+
# tmp_file = hf_bucket_url(model_name, filename=item)
|
717 |
+
# tmp_file = cached_path(tmp_file, cache_dir=cache_dir)
|
718 |
+
# os.rename(tmp_file, os.path.join(cache_dir, item))
|
719 |
|
720 |
|
721 |
def init_tokenizer():
|