Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize file utils #16264

Merged
merged 11 commits into from
Mar 23, 2022
Prev Previous commit
Next Next commit
More fixes
  • Loading branch information
sgugger committed Mar 23, 2022
commit 4c8a8bf56d225176f20025c8d3e4e6f5a6fe659b
6 changes: 5 additions & 1 deletion src/transformers/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@
from .generic_utils import is_tensor # noqa: F401
from .generic_utils import to_numpy # noqa: F401
from .generic_utils import to_py_obj # noqa: F401
from .import_utils import ENV_VARS_TRUE_AND_AUTO_VALUES # noqa: F401
from .import_utils import TORCH_FX_REQUIRED_VERSION # noqa: F401
from .import_utils import USE_JAX # noqa: F401
from .import_utils import USE_TF # noqa: F401
from .import_utils import USE_TORCH # noqa: F401
from .import_utils import DummyObject # noqa: F401
from .import_utils import _LazyModule # noqa: F401
from .import_utils import is_apex_available # noqa: F401
Expand Down Expand Up @@ -108,6 +112,7 @@
from .import_utils import torch_required # noqa: F401
from .import_utils import torch_version # noqa: F401
from .import_utils import (
ENV_VARS_TRUE_VALUES,
_tf_version,
_torch_version,
is_tf_available,
Expand All @@ -120,7 +125,6 @@
logger = logging.get_logger(__name__) # pylint: disable=invalid-name


ENV_VARS_TRUE_VALUES = {"1", "ON", "YES", "TRUE"}
_is_offline_mode = True if os.environ.get("TRANSFORMERS_OFFLINE", "0").upper() in ENV_VARS_TRUE_VALUES else False


Expand Down
1 change: 1 addition & 0 deletions src/transformers/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def is_torch_tf32_available():
return True


torch_version = None
_torch_fx_available = _torch_onnx_dict_inputs_support_available = False
if _torch_available:
torch_version = version.parse(importlib_metadata.version("torch"))
Expand Down