Upload scripts/decode_reimplementation.py with huggingface_hub
Browse files
scripts/decode_reimplementation.py
CHANGED
|
@@ -120,14 +120,20 @@ def import_stack():
|
|
| 120 |
ARIMA = None
|
| 121 |
statsmodels_import_error = f"{type(exc).__name__}: {exc}"
|
| 122 |
|
|
|
|
|
|
|
| 123 |
tf_import_error = None
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
return {
|
| 133 |
"np": np,
|
|
|
|
| 120 |
ARIMA = None
|
| 121 |
statsmodels_import_error = f"{type(exc).__name__}: {exc}"
|
| 122 |
|
| 123 |
+
tf = None
|
| 124 |
+
keras = None
|
| 125 |
tf_import_error = None
|
| 126 |
+
disable_tf_when_torch_available = os.environ.get("DECODE_DISABLE_TENSORFLOW", "1") == "1"
|
| 127 |
+
if disable_tf_when_torch_available and torch is not None:
|
| 128 |
+
tf_import_error = "disabled because PyTorch is available"
|
| 129 |
+
else:
|
| 130 |
+
try:
|
| 131 |
+
import tensorflow as tf
|
| 132 |
+
from tensorflow import keras
|
| 133 |
+
except Exception as exc:
|
| 134 |
+
tf = None
|
| 135 |
+
keras = None
|
| 136 |
+
tf_import_error = f"{type(exc).__name__}: {exc}"
|
| 137 |
|
| 138 |
return {
|
| 139 |
"np": np,
|