Spaces:
Running
Running
Update neural_acoustic_distance.py
Browse files
neural_acoustic_distance.py
CHANGED
|
@@ -39,7 +39,7 @@ def compute_costs(gcm):
|
|
| 39 |
return res, n
|
| 40 |
|
| 41 |
|
| 42 |
-
|
| 43 |
def load_wav2vec2_featurizer(model_id: str, layer: Optional[int] = None):
|
| 44 |
transformers.logging.set_verbosity(transformers.logging.ERROR)
|
| 45 |
|
|
@@ -224,3 +224,10 @@ if filename_x is not None and filename_y is not None and layer is not None:
|
|
| 224 |
|
| 225 |
print('8. End', datetime.now().strftime('%d-%m-%Y %H:%M:%S')) # test
|
| 226 |
print(f"9. RAM used: {psutil.Process().memory_info().rss / (1024 * 1024):.2f} MB") # test
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
return res, n
|
| 40 |
|
| 41 |
|
| 42 |
+
#@st.cache(show_spinner=False, hash_funcs={torch.nn.parameter.Parameter: lambda _: None}, max_entries=1)
|
| 43 |
def load_wav2vec2_featurizer(model_id: str, layer: Optional[int] = None):
|
| 44 |
transformers.logging.set_verbosity(transformers.logging.ERROR)
|
| 45 |
|
|
|
|
| 224 |
|
| 225 |
print('8. End', datetime.now().strftime('%d-%m-%Y %H:%M:%S')) # test
|
| 226 |
print(f"9. RAM used: {psutil.Process().memory_info().rss / (1024 * 1024):.2f} MB") # test
|
| 227 |
+
|
| 228 |
+
for name in dir():
|
| 229 |
+
if not name.startswith('_'):
|
| 230 |
+
del globals()[name]
|
| 231 |
+
|
| 232 |
+
import gc
|
| 233 |
+
gc.collect()
|