Summary
hy3dgen/texgen/hunyuanpaint/pipeline.py:598 calls torch.range, which is deprecated and emits a UserWarning on every call ("torch.range is deprecated and will be removed in a future release because its behavior is inconsistent with Python's range builtin. Instead, use torch.arange, which produces values in [start, end)." — verified on torch 2.11.0). It is the only torch.range usage in this repo:
if self.is_turbo:
bsz = 3
N_gen = 15
index = torch.range(29, 0, -bsz, device='cuda').long() # ← emits UserWarning on every call
timesteps = self.solver.ddim_timesteps[index]
This runs in the turbo path of the paint pipeline on every generation.
Proposed fix
torch.range is end-inclusive: torch.range(29, 0, -3) produces [29, 26, 23, 20, 17, 14, 11, 8, 5, 2] (10 values; 0 is not reachable with step -3). The torch.arange equivalent (open interval, step excluded end) is:
index = torch.arange(29, -1, -bsz, device='cuda').long()
(-1 = last included value 2 + step -3; torch.arange with integer inputs returns int64, so the explicit .long() is a no-op — kept to match the surrounding style.)
Validation (torch 2.11.0+cpu)
torch.equal(torch.range(29, 0, -3), torch.arange(29, -1, -3)) → True (identical values, end-inclusive semantics preserved).
- With
warnings.simplefilter("error", UserWarning): the current line raises the deprecation UserWarning; torch.arange constructs cleanly.
Impact
- No deprecation
UserWarning during turbo inference on any supported torch version; identical timestep indices.
References
Summary
hy3dgen/texgen/hunyuanpaint/pipeline.py:598callstorch.range, which is deprecated and emits aUserWarningon every call ("torch.range is deprecated and will be removed in a future release because its behavior is inconsistent with Python's range builtin. Instead, use torch.arange, which produces values in [start, end)." — verified on torch 2.11.0). It is the onlytorch.rangeusage in this repo:This runs in the turbo path of the paint pipeline on every generation.
Proposed fix
torch.rangeis end-inclusive:torch.range(29, 0, -3)produces[29, 26, 23, 20, 17, 14, 11, 8, 5, 2](10 values; 0 is not reachable with step -3). Thetorch.arangeequivalent (open interval, step excluded end) is:(
-1= last included value2+ step-3;torch.arangewith integer inputs returnsint64, so the explicit.long()is a no-op — kept to match the surrounding style.)Validation (torch 2.11.0+cpu)
torch.equal(torch.range(29, 0, -3), torch.arange(29, -1, -3))→True(identical values, end-inclusive semantics preserved).warnings.simplefilter("error", UserWarning): the current line raises the deprecationUserWarning;torch.arangeconstructs cleanly.Impact
UserWarningduring turbo inference on any supported torch version; identical timestep indices.References
torch.rangewarning (2025-06-09) and patched it locally; no maintainer response, code still unfixed.