Reformat using black

This commit is contained in:
Deniz Şafak
2025-10-27 17:26:54 +03:00
parent 9d2e8bed00
commit 47fe6341b4
7 changed files with 701 additions and 381 deletions
+5 -3
View File
@@ -14,6 +14,7 @@ warnings.filterwarnings("ignore")
def detect_encoding(file_path):
import chardet
import charset_normalizer
with open(file_path, "rb") as f:
raw_data = f.read()
detected_encoding = None
@@ -28,6 +29,7 @@ def detect_encoding(file_path):
encoding = detected_encoding if detected_encoding else "utf-8"
return encoding.lower()
def get_resource_path(package, resource):
"""
Get the path to a resource file, with fallback to local file system.
@@ -261,18 +263,18 @@ def get_gpu_acceleration(enabled):
if not enabled:
return "GPU available but using CPU.", False
# Check for Apple Silicon MPS
if platform.system() == "Darwin" and platform.processor() == "arm":
if torch.backends.mps.is_available():
return "MPS GPU available and enabled.", True
else:
return "MPS GPU not available on Apple Silicon. Using CPU.", False
# Check for CUDA
if cuda_available():
return "CUDA GPU available and enabled.", True
# Gather CUDA diagnostic info if not available
try:
cuda_devices = torch.cuda.device_count()