chore: add cpu/cu124 extras for PyTorch index selection#87
chore: add cpu/cu124 extras for PyTorch index selection#87MaleicAcid wants to merge 1 commit intozh-plus:masterfrom
Conversation
b6c54ad to
de933e1
Compare
8e73713 to
d102fba
Compare
d102fba to
e0ef311
Compare
|
@zh-plus Hi. My original plan was to get proper code checks (pyright, ruff) running in CI before the 1.6.2 release. Seemed straightforward enough — but it turned into a bit of a rabbit hole. First, I realized the dependency management needed some work. CI runners don't have GPUs, so installing the default GPU-enabled PyTorch would just crash when trying to import torch. That led to the cpu/cu124 extras PR, which lets CI use uv sync --extra cpu to install a lightweight CPU-only PyTorch. That part is working fine now. But then I hit a wall: deepfilternet. The package hasn't seen a new PyPI release since v0.5.6, and it imports torchaudio.backend.common — a module that was removed in torchaudio 2.6+. So on any recent torchaudio version, import df simply crashes. The fix exists in their GitHub repo but was never published. And with torchaudio itself entering maintenance mode and actively removing APIs, this is only going to get worse over time. I'd suggest we go ahead and release 1.6.2 as-is without waiting for the CI improvements, since the deepfilternet issue needs a proper discussion. Here are a few directions we could go:
|
|
Thanks for working on this. I agree with the overall direction, but I don't think this is ready to merge yet. A few things should be fixed first:
More broadly, I agree that I'm currently looking into possible replacements for |
Could we pin the Torch-related versions and move forward with the 1.6.2 release instead? |
|
Agreed. I will pin the Torch dependencies and proceed with the 1.6.2 release this afternoon. We can put this PR on hold for now. |
Add cpu/cu124 extras for PyTorch index selection
Summary
Add optional extras (
cpu,cu124) that allow users and CI to override which PyTorch index is used, while keeping the default behavior unchanged.Motivation
CI environments typically cannot install the full CUDA PyTorch stack, which blocks running pyright for type checking. With this change, CI can use
uv sync --extra cputo install a lightweight CPU-only PyTorch and run type checks cleanly.Behavior
pip install openlrcuv syncuv sync --extra cpupytorch-cpuindexuv sync --extra cu124pytorch-cu124indexThis is not a breaking change.
pip install openlrcanduv syncwithout extras behave exactly as before.Downstream usage
If your project depends on openlrc and you want to switch between CPU and GPU PyTorch builds (e.g. CPU for development/CI, GPU for production), map openlrc's extras through your own
pyproject.toml:Then select the variant at install time:
What changed
pyproject.toml: addedcpuandcu124optional-dependencies, both listingtorch,torchvision,torchaudio(these packages remain in coredependenciesas well)pytorch-cpuindex alongside the existingpytorch-cu124index[tool.uv]conflicts to prevent both extras from being enabled simultaneously[tool.uv.sources]to route each extra to its corresponding PyTorch index