Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,6 +23,7 @@ os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
|
|
23 |
|
24 |
def initialize_zero_gpu():
|
25 |
"""Initialize Hugging Face ZeroGPU"""
|
|
|
26 |
try:
|
27 |
# Check if CUDA is available
|
28 |
if torch.cuda.is_available():
|
@@ -33,6 +34,13 @@ def initialize_zero_gpu():
|
|
33 |
print("CUDA is not available. Using CPU instead.")
|
34 |
except Exception as e:
|
35 |
print(f"Error initializing Hugging Face ZeroGPU: {str(e)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
def initialize_environment():
|
38 |
"""Initialize application environment and configurations"""
|
@@ -377,15 +385,7 @@ def signal_handler(signum, frame):
|
|
377 |
sys.exit(0)
|
378 |
|
379 |
if __name__ == "__main__":
|
380 |
-
|
381 |
-
"""Initialize Hugging Face ZeroGPU (if available)"""
|
382 |
-
if torch.cuda.is_available():
|
383 |
-
# Install CUDA drivers and adjust library versions if necessary
|
384 |
-
# ... (refer to solutions above)
|
385 |
-
deepspeed.init_distributed()
|
386 |
-
print("ZeroGPU initialized successfully.")
|
387 |
-
else:
|
388 |
-
print("CUDA is not available. Using CPU instead.")
|
389 |
|
390 |
# Register cleanup handlers
|
391 |
atexit.register(cleanup)
|
@@ -419,4 +419,4 @@ if __name__ == "__main__":
|
|
419 |
logger.error(f"Error launching application: {str(e)}")
|
420 |
raise
|
421 |
finally:
|
422 |
-
logger.info("Application shutdown")
|
|
|
23 |
|
24 |
def initialize_zero_gpu():
|
25 |
"""Initialize Hugging Face ZeroGPU"""
|
26 |
+
logger.info("Initializing Hugging Face ZeroGPU...")
|
27 |
try:
|
28 |
# Check if CUDA is available
|
29 |
if torch.cuda.is_available():
|
|
|
34 |
print("CUDA is not available. Using CPU instead.")
|
35 |
except Exception as e:
|
36 |
print(f"Error initializing Hugging Face ZeroGPU: {str(e)}")
|
37 |
+
logger.error(f"Error initializing Hugging Face ZeroGPU: {str(e)}")
|
38 |
+
|
39 |
+
# Check for the missing autotune file
|
40 |
+
autotune_file = '/home/user/.triton/autotune'
|
41 |
+
if not os.path.exists(autotune_file):
|
42 |
+
logger.warning(f"Missing autotune file: {autotune_file}. This may affect performance.")
|
43 |
+
print(f"Warning: Missing autotune file: {autotune_file}. This may affect performance.")
|
44 |
|
45 |
def initialize_environment():
|
46 |
"""Initialize application environment and configurations"""
|
|
|
385 |
sys.exit(0)
|
386 |
|
387 |
if __name__ == "__main__":
|
388 |
+
initialize_zero_gpu()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
|
390 |
# Register cleanup handlers
|
391 |
atexit.register(cleanup)
|
|
|
419 |
logger.error(f"Error launching application: {str(e)}")
|
420 |
raise
|
421 |
finally:
|
422 |
+
logger.info("Application shutdown")
|