Import integration libraries first (#7650)

* Import intergration libraries first

* isort and black happiness

* flake8 happiness

* Add a test

* Black reformat

* Ignore import order in tests

* A heavy-handed method of disabling comet for tests

* Remove comet_ml tests

* Run black on setup.py
This commit is contained in:
Doug Blank
2020-10-09 09:13:22 -07:00
committed by GitHub
parent 4dcc424de3
commit 9618cd6964
2 changed files with 11 additions and 7 deletions

View File

@@ -134,9 +134,7 @@ setup(
"sacremoses", "sacremoses",
], ],
extras_require=extras, extras_require=extras,
entry_points={ entry_points={"console_scripts": ["transformers-cli=transformers.commands.transformers_cli:main"]},
"console_scripts": ["transformers-cli=transformers.commands.transformers_cli:main"]
},
python_requires=">=3.6.0", python_requires=">=3.6.0",
classifiers=[ classifiers=[
"Development Status :: 5 - Production/Stable", "Development Status :: 5 - Production/Stable",

View File

@@ -2,13 +2,11 @@
import math import math
import os import os
from .file_utils import is_torch_tpu_available
from .trainer_callback import TrainerCallback
from .trainer_utils import PREFIX_CHECKPOINT_DIR, BestRun
from .utils import logging
# Import 3rd-party integrations first:
try: try:
# Comet needs to be imported before any ML frameworks
import comet_ml # noqa: F401 import comet_ml # noqa: F401
_has_comet = True _has_comet = True
@@ -53,6 +51,14 @@ except ImportError:
except ImportError: except ImportError:
_has_tensorboard = False _has_tensorboard = False
# No transformer imports above this point
from .file_utils import is_torch_tpu_available
from .trainer_callback import TrainerCallback
from .trainer_utils import PREFIX_CHECKPOINT_DIR, BestRun
from .utils import logging
logger = logging.get_logger(__name__) logger = logging.get_logger(__name__)