Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve the module importer's robustness
This fixes the following issues: - The old code inserted the "current working dir" into the module search paths, which has no correlation to the OneTrainer directory if the user executes the scripts with another active working directory. Now we use the actual OneTrainer directory regardless of its location, by leveraging the excellent Path library. - The previous code inserted our path *last*, which meant that every import prioritized all other paths before looking in OneTrainer. This could lead to shadowing issues if a user has a system where a path contains another module named "modules", such as their own homemade project. We now insert ourselves at the top, as the highest priority. - `scripts/install_zluda.py` was duplicating the efforts of importing modules. It clearly did that to avoid trying to load ZLUDA before it has been installed, but that's better handled by a loader flag instead. - `scripts/sample.py` was permanently broken, since it attempted to import a module before fixing the import path.
- Loading branch information