SWivid / F5-TTS

Official code for "F5-TTS: A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching"
https://arxiv.org/abs/2410.06885
MIT License
7.71k stars 964 forks source link

UnboundLocalError: local variable 'bigvgan' referenced before assignment #371

Closed trigsoft closed 3 weeks ago

trigsoft commented 1 month ago

I tried on colab. it works fine with default vocoder.

It returned the error when using bigvgan.

ZhikangNiu commented 1 month ago

@trigsoft Can you provide your code to help me reproduce this problem

trigsoft commented 1 month ago

https://colab.research.google.com/drive/1PHd9Vy6Mf5hNXcudNl8nV9iDv4ht2LTq?usp=sharing

I will send a mail to you with a ref audio. I cannot gen an proper audio with the same content....

ZhikangNiu commented 1 month ago

@trigsoft you need to clone bigvgan follow README instruction, or the following command

截屏2024-11-02 22 11 46
ZhikangNiu commented 1 month ago
截屏2024-11-02 22 13 29
ZhikangNiu commented 1 month ago

More details is written on the README

trigsoft commented 1 month ago

Can you send me the link please? I don't see the git clone line?

This is what I see

git submodule update --init --recursive # (optional, if need bigvgan)

trigsoft commented 1 month ago

Same error.

!git clone https://github.com/SWivid/F5-TTS.git %cd F5-TTS/src/third_party !git clone https://github.com/NVIDIA/BigVGAN.git %cd ../.. !pip install -e .

ZhikangNiu commented 1 month ago

Same error.

!git clone https://github.com/SWivid/F5-TTS.git %cd F5-TTS/src/third_party !git clone https://github.com/NVIDIA/BigVGAN.git %cd ../.. !pip install -e .

have you changed the bigvgan source code?

trigsoft commented 1 month ago

Same error. !git clone https://github.com/SWivid/F5-TTS.git %cd F5-TTS/src/third_party !git clone https://github.com/NVIDIA/BigVGAN.git %cd ../.. !pip install -e .

have you changed the bigvgan source code?

Current code: !pip install torch==2.3.0+cu118 torchaudio==2.3.0+cu118 --extra-index-url https://download.pytorch.org/whl/cu118 !git clone https://github.com/SWivid/F5-TTS.git %cd F5-TTS/src/third_party !git clone https://github.com/NVIDIA/BigVGAN.git %cd ../.. !pip install -e .

Modified code:

Copyright (c) 2024 NVIDIA CORPORATION.

Licensed under the MIT license.

Adapted from https://github.com/jik876/hifi-gan under the MIT license.

LICENSE is in incl_licenses directory.

import os import sys sys.path.append(os.path.dirname(os.path.abspath(file)))

import os import json from pathlib import Path from typing import Optional, Union, Dict

import torch import torch.nn as nn from torch.nn import Conv1d, ConvTranspose1d from torch.nn.utils import weight_norm, remove_weight_norm

import activations from utils import init_weights, get_padding from alias_free_activation.torch.act import Activation1d as TorchActivation1d from env import AttrDict

SWivid commented 3 weeks ago

will close this issue, feel free to open if further questions