Skip to content

App/Demo exception since fix: use weights_only=True (CWE-502) #392

Description

@bluemoehre

Latest commit (303b283) is causing exception on startup when using the official ROCm image docker.io/rocm/pytorch:rocm7.2.3_ubuntu24.04_py3.12_pytorch_release_2.10.0.

[vibevoice] | You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
[vibevoice] | ERROR:    Traceback (most recent call last):
[vibevoice] |   File "/opt/venv/lib/python3.12/site-packages/starlette/routing.py", line 638, in lifespan
[vibevoice] |     async with self.lifespan_context(app) as maybe_state:
[vibevoice] |   File "/opt/venv/lib/python3.12/site-packages/fastapi/routing.py", line 241, in __aenter__
[vibevoice] |     await self._router._startup()
[vibevoice] |   File "/opt/venv/lib/python3.12/site-packages/fastapi/routing.py", line 4884, in _startup
[vibevoice] |     await handler()
[vibevoice] |   File "/app/demo/web/app.py", line 353, in _startup
[vibevoice] |     service.load()
[vibevoice] |   File "/app/demo/web/app.py", line 126, in load
[vibevoice] |     self._ensure_voice_cached(self.default_voice_key)
[vibevoice] |   File "/app/demo/web/app.py", line 164, in _ensure_voice_cached
[vibevoice] |     prefilled_outputs = torch.load(
[vibevoice] |                         ^^^^^^^^^^^
[vibevoice] |   File "/opt/venv/lib/python3.12/site-packages/torch/serialization.py", line 1548, in load
[vibevoice] |     raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
[vibevoice] | _pickle.UnpicklingError: Weights only load failed. In PyTorch 2.6, we changed the default value of the `weights_only` argument in `torch.load` from `False` to `True`. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
[vibevoice] | Please file an issue with the following so that we can make `weights_only=True` compatible with your use case: WeightsUnpickler error: 
[vibevoice] | 
[vibevoice] | Can only SETITEMS for dict, collections.OrderedDict, collections.Counter, but got <class 'transformers.modeling_outputs.BaseModelOutputWithPast'>
[vibevoice] | 
[vibevoice] | Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.
[vibevoice] | 
[vibevoice] | ERROR:    Application startup failed. Exiting.

Reverting to previous commit (e73d1e1) solves the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions