daswer123 / xtts-finetune-webui

Slightly improved official version for finetune xtts
141 stars 50 forks source link

Error Report: AttributeError in xtts_demo.py on Running start.sh and install.sh #37

Open Eldpit opened 1 week ago

Eldpit commented 1 week ago

Description: When running the start.sh and install.sh scripts, I encountered an AttributeError in xtts_demo.py. The error occurs due to an incorrect import of GradScaler from torch.amp.

Steps to Reproduce:

Clone the repository. Run start.sh or install.sh.

Error Message:

Traceback (most recent call last):
  File "/root/TTS/xtts-finetune-webui/xtts_demo.py", line 19, in <module>
    from utils.gpt_train import train_gpt
  File "/root/TTS/xtts-finetune-webui/utils/gpt_train.py", line 6, in <module>
    from trainer import Trainer, TrainerArgs
  File "/root/TTS/xtts-finetune-webui/venv/lib/python3.10/site-packages/trainer/__init__.py", line 4, in <module>
    from trainer.model import *
  File "/root/TTS/xtts-finetune-webui/venv/lib/python3.10/site-packages/trainer/model.py", line 7, in <module>
    from trainer.trainer import Trainer
  File "/root/TTS/xtts-finetune-webui/venv/lib/python3.10/site-packages/trainer/trainer.py", line 63, in <module>
    class Trainer:
  File "/root/TTS/xtts-finetune-webui/venv/lib/python3.10/site-packages/trainer/trainer.py", line 947, in Trainer
    def _grad_clipping(self, grad_clip: float, optimizer: torch.optim.Optimizer, scaler: torch.amp.GradScaler):
AttributeError: module 'torch.amp' has no attribute 'GradScaler'

Environment:

OS: UBUNTU 22.04 Python: 3.10

Aloukik21 commented 1 week ago

same error

Aloukik21 commented 1 week ago

fixed it. Here's updated install.sh file:


#!/bin/bash

# Create a Python virtual environment
python -m venv venv
# Activate the virtual environment
source venv/bin/activate

# Install other dependencies from requirements.txt
pip install --upgrade pip
pip install -r requirements.txt 
pip install torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu118

python xtts_demo.py
gunnarsal commented 1 week ago

@Aloukik21 did you have to remove all the previous installation (fresh folder) or you just updated the install.sh file and ran the install bat again?

Made the changes but no luck, same error

Aloukik21 commented 1 week ago

try

--force --no-cache-dir

in pip lines

gunnarsal commented 1 week ago

try

--force --no-cache-dir

in pip lines

Sorry, where do I put it? into the install.sh?

Aloukik21 commented 1 week ago

Here's updated install.sh


#!/bin/bash

# Create a Python virtual environment
python -m venv venv
# Activate the virtual environment
source venv/bin/activate

# Install other dependencies from requirements.txt
pip install --upgrade pip
pip install -r requirements.txt --force --no-cache-dir
pip install torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu118 --force --no-cache-dir

python xtts_demo.py