Automatic GPU Detection: Script now does a check to see if CUDA is available. If so, it will use the GPU by default (can be overridden by using the -d/--device flag).
If no CUDA support is detected, the script will use the CPU instead.
Move out of the Target Directory to be cleaned: Before attempting to remove the directory, I changed the current working directory to OUTPUT_PATH to ensure we are not inside the directory we're trying to delete.
Minor Improvements
Path Handling: Improved the way paths are constructed using os.path.join() consistently instead of a mix of string concatenation and joining. This ensures paths are constructed in a platform-independent manner.
Error Handling: Added a try-except block around the shutil.rmtree() call. If a PermissionError occurs, a message is printed indicating the directory might still be in use. This provides a clearer error message and ensures the script doesn't crash due to this specific error.
Checking for Stem File: Modified the path for checking and renaming the stem file to ensure it's constructed correctly.
Addresses the following issues: https://github.com/axeldelafosse/stemgen/issues/37 & https://github.com/axeldelafosse/stemgen/issues/9
Feature Improvement for Issue https://github.com/axeldelafosse/stemgen/issues/9:
-d
/--device
flag). If no CUDA support is detected, the script will use the CPU instead.Bug Fix for Issue https://github.com/axeldelafosse/stemgen/issues/37:
OUTPUT_PATH
to ensure we are not inside the directory we're trying to delete. Minor Improvementsos.path.join()
consistently instead of a mix of string concatenation and joining. This ensures paths are constructed in a platform-independent manner.try-except
block around theshutil.rmtree()
call. If aPermissionError
occurs, a message is printed indicating the directory might still be in use. This provides a clearer error message and ensures the script doesn't crash due to this specific error.