Merge remote-tracking branch 'origin/main'

This commit is contained in:
czzhangheng 2025-08-18 21:07:49 +08:00
commit 42b9cd3342
3 changed files with 6 additions and 2 deletions

1
.gitignore vendored
View File

@ -170,3 +170,4 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
.DS_Store
Result.xlsx

Binary file not shown.

7
run.py
View File

@ -23,8 +23,11 @@ import yaml
def main():
args = parse_args()
# Set device
if torch.cuda.is_available() and args['device'] != 'cpu':
# Set device (prefer MPS on macOS, then CUDA, else CPU)
if hasattr(torch.backends, 'mps') and torch.backends.mps.is_available() and args['device'] != 'cpu':
args['device'] = 'mps'
args['model']['device'] = args['device']
elif torch.cuda.is_available() and args['device'] != 'cpu':
torch.cuda.set_device(int(args['device'].split(':')[1]))
args['model']['device'] = args['device']
else: