[hubconf] Modify pythonpath to get canonical imports to work

See https://github.com/huggingface/transformers/pull/3881/files#r412292660

Should we remove SRC_DIR from sys.path right after the imports, @aaugustin?
This commit is contained in:
Julien Chaumond 2020-04-23 16:27:43 -04:00
parent 77b75d2c78
commit cbbb3c43c5

View file

@ -1,12 +1,19 @@
from src.transformers import (
import os
import sys
SRC_DIR = os.path.join(os.path.dirname(__file__), "src")
sys.path.append(SRC_DIR)
from transformers import (
AutoConfig,
AutoModel,
AutoModelForQuestionAnswering,
AutoModelForSequenceClassification,
AutoModelWithLMHead,
AutoTokenizer,
add_start_docstrings,
)
from src.transformers.file_utils import add_start_docstrings
dependencies = ["torch", "numpy", "tokenizers", "boto3", "filelock", "requests", "tqdm", "regex", "sentencepiece", "sacremoses"]