Custom PyTorch wheel support, GPU acceleration, and MPS device support#61
Merged
Conversation
jewilder
approved these changes
May 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TL;DR: PyTorch inference test can be instructed to run on GPU or CPU and test has the ability to specify a custom PyTorch wheel to use vs. the default.
Adds the ability to run PyTorch inference with custom-built wheels, optional CUDA/cuDNN installation, GPU/CPU device selection, and Apple MPS (Metal Performance Shaders) support on macOS. All features are opt-in via independent parameters existing default behavior (CPU inferencing vs. GPU) is unchanged.
New Parameters
custom_resources_path''use_custom_pytorch_wheelfalsetorch-*.whlfrom the custom resources path instead of pipinstall_cudafalsecuda_*.exefrom the custom resources pathinstall_cudnnfalsecudnn*.exefrom the custom resources pathuse_gputruefalse, forces CPU-only inference (--no-gpu)Each parameter is independent. Examples:
MPS Device Support
Updated
inference.py(shared between Windows and macOS) to detect Apple Metal GPU:macOS Apple Silicon now uses MPS acceleration by default instead of falling back to CPU. The
hasattrguard ensures backward compatibility with older PyTorch versions.Device Priority
cudacudampsuse_gpu=falsecpuPrep Script Changes (Windows)
-customResourcesPath,-installCuda,-installCudnnparameterscuda_*.exe, PATH refresh,nvcc --versionverificationcudnn*.exetorch-*.whl+requirements_custom.txt(tokenizers, transformers, accelerate)3.13.1, Arm64:3.13.1-arm)prep_versionbumped to"12"Run Script Changes
-noGpuswitch, passes--no-gputoinference.py--no-gpuargument, passes through toinference.pyCUDA_PATHis set)macOS Scenario Changes
use_gpuparameter tomac_pytorch_inf.pymac_pytorch_inf_run.shaccepts--no-gpuand passes it to inferenceinference.pyis now identical between Windows and macOS (copyright header + MPS support)Example: HOBL.ini PyTorch configuration for Windows
; ============================================================
; PyTorch Inference - Custom wheel + CUDA + cuDNN (full custom)
; ============================================================
[pytorch_inf]
loops: 2
custom_resources_path: C:\pytorch_custom_bits
use_custom_pytorch_wheel: true
install_cuda: true
install_cudnn: true
Files Changed