Spaces:
Running
on
L40S
Running
on
L40S
Upload ./infer/utils.py with huggingface_hub
Browse files- infer/utils.py +5 -2
infer/utils.py
CHANGED
@@ -30,6 +30,8 @@ import numpy as np
|
|
30 |
import torch
|
31 |
from torch.cuda.amp import autocast, GradScaler
|
32 |
from functools import wraps
|
|
|
|
|
33 |
|
34 |
|
35 |
def seed_everything(seed):
|
@@ -55,7 +57,8 @@ def timing_decorator(category: str):
|
|
55 |
end_time = time.time()
|
56 |
elapsed_time = end_time - start_time
|
57 |
func.call_count += 1
|
58 |
-
|
|
|
59 |
return result
|
60 |
return wrapper
|
61 |
return decorator
|
@@ -90,4 +93,4 @@ def str_to_bool(s):
|
|
90 |
elif s.lower() in ['false', 'f', 'no', 'n', '0']:
|
91 |
return False
|
92 |
else:
|
93 |
-
raise f"
|
|
|
30 |
import torch
|
31 |
from torch.cuda.amp import autocast, GradScaler
|
32 |
from functools import wraps
|
33 |
+
from datetime import datetime
|
34 |
+
import gc
|
35 |
|
36 |
|
37 |
def seed_everything(seed):
|
|
|
57 |
end_time = time.time()
|
58 |
elapsed_time = end_time - start_time
|
59 |
func.call_count += 1
|
60 |
+
gc.collect()
|
61 |
+
print(f"[{datetime.now()}][HunYuan3D]-[{category}], cost time: {elapsed_time:.4f}s") # huiwen
|
62 |
return result
|
63 |
return wrapper
|
64 |
return decorator
|
|
|
93 |
elif s.lower() in ['false', 'f', 'no', 'n', '0']:
|
94 |
return False
|
95 |
else:
|
96 |
+
raise f"{s} not in ['true', 't', 'yes', 'y', '1', 'false', 'f', 'no', 'n', '0']"
|