Skip to content

AttributeError: module 'torchvision.io' has no attribute 'write_video' #381

Description

@ChrisMStorer

During processing I get this error:

AttributeError: module 'torchvision.io' has no attribute 'write_video'

Some context:

Unloaded SiglipVisionModel as complete.
Moving DynamicSwap_HunyuanVideoTransformer3DModelPacked to cuda:0 with preserved memory: 6 GB
100%|████████████████████████████████████████████████████████████████████████████| 25/25 [05:59<00:00, 14.37s/it]
Offloading DynamicSwap_HunyuanVideoTransformer3DModelPacked from cuda:0 to preserve memory: 8 GB
Loaded AutoencoderKLHunyuanVideo to cuda:0 as complete.
Unloaded AutoencoderKLHunyuanVideo as complete.
Traceback (most recent call last):
  File "C:\Users\chris\source\repos\FramePack-Studio\modules\pipelines\worker.py", line 915, in worker
    save_bcthw_as_mp4(history_pixels, output_filename, fps=30, crf=settings.get("mp4_crf"))
  File "C:\Users\chris\source\repos\FramePack-Studio\diffusers_helper\utils.py", line 279, in save_bcthw_as_mp4
    torchvision.io.write_video(output_filename, x, fps=fps, video_codec='libx264', options={'crf': str(int(crf))})
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'torchvision.io' has no attribute 'write_video'
Unloaded DynamicSwap_LlamaModel as complete.
Unloaded CLIPTextModel as complete.l

My torch / python versions:


(venv) C:\Users\chris\source\repos\FramePack-Studio>pip show torch torchvision
Name: torch
Version: 2.11.0+cu128
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org
Author:
Author-email: PyTorch Team <packages@pytorch.org>
License: BSD-3-Clause
Location: C:\Users\chris\source\repos\FramePack-Studio\venv\Lib\site-packages
Requires: filelock, fsspec, jinja2, networkx, setuptools, sympy, typing-extensions
Required-by: accelerate, basicsr, facexlib, gfpgan, peft, realesrgan, timm, torchsde, torchvision
---
Name: torchvision
Version: 0.26.0+cu128
Summary: image and video datasets and models for torch deep learning
Home-page: https://github.com/pytorch/vision
Author: PyTorch Core Team
Author-email: soumith@pytorch.org
License: BSD
Location: C:\Users\chris\source\repos\FramePack-Studio\venv\Lib\site-packages
Requires: numpy, pillow, torch
Required-by: basicsr, facexlib, gfpgan, realesrgan, timm

My python version:

(venv) C:\Users\chris\source\repos\FramePack-Studio>python --version
Python 3.11.9

My CUDA version and GPU:

...

Python 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import torch
torch.cuda.is_available()
True
torch.cuda.device_count()
1
torch.cuda.get_device_name(0)
'NVIDIA GeForce RTX 5060'

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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