We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2a502f7 commit 8841094Copy full SHA for 8841094
torchao/__init__.py
@@ -1,11 +1,20 @@
1
import torch
2
import logging
3
4
+# We use this "hack" to set torchao.__version__ correctly
5
+# the version of ao is dependent on environment variables for multiple architectures
6
+# For local development this will default to whatever is version.txt
7
+# For release builds this will be set the version+architecture_postfix
8
+from importlib.metadata import version, PackageNotFoundError
9
+try:
10
+ __version__ = version("torchao")
11
+except PackageNotFoundError:
12
+ __version__ = 'unknown' # In case this logic breaks don't break the build
13
+
14
_IS_FBCODE = (
15
hasattr(torch._utils_internal, "IS_FBSOURCE") and
16
torch._utils_internal.IS_FBSOURCE
17
)
-
18
if not _IS_FBCODE:
19
try:
20
from . import _C
0 commit comments