IAHispano / Applio

A simple, high-quality voice conversion tool focused on ease of use and performance
https://applio.org
MIT License
1.81k stars 292 forks source link

[Question]: what is pth_path in core.py model_extract? #871

Open BornSaint opened 1 week ago

BornSaint commented 1 week ago

Project Version

3.2.3

Platform and OS Version

Linux x64

Affected Devices

PC

Existing Issues

No response

What happened?

usage: core.py model_extract [-h] --pth_path PTH_PATH --model_name MODEL_NAME
                             --sample_rate {32000,40000,48000}
                             --pitch_guidance {True,False}
                             [--rvc_version {v1,v2}] --epoch

I don't know what i should insert in --pth_path, it shouldn't ask --model_name and try to find and extract from logs dir?

Steps to reproduce

  1. ...

Expected behavior

extract

Attachments

No response

Screenshots or Videos

No response

Additional Information

No response

BornSaint commented 1 week ago

tried the existent pth in logs dir for small pth model i got:

An error occurred extracting the model: 'dict' object has no attribute 'half'

for G_steps.pth i got:

An error occurred extracting the model: 'collections.OrderedDict' object has no attribute 'half'

MalcolmReed-ent commented 23 hours ago

The --pth_path argument expects the path to your trained model's .pth file. These files are PyTorch model weights that are saved during or after training. They are typically located in:

  1. The logs/MODEL_NAME directory for your trained models
  2. The weights directory for pretrained models

For example, if you trained a model called "my_voice", you might find files like: logs/my_voice/G_32000.pth logs/my_voice/G_latest.pth logs/my_voice/D_32000.pth The correct file to use would be the Generator (G) model file, not the Discriminator (D) file.

The errors you're seeing suggest that:

  1. 'dict' object has no attribute 'half' - You might be trying to use a model file that's not compatible with the extraction process
  2. 'collections.OrderedDict' object has no attribute 'half' - This typically happens when trying to extract from a checkpoint file rather than the final model file

Here's how you should use the command: python core.py model_extract --pth_path "logs/my_voice/G_32000.pth" --model_name "my_voice" --sample_rate 40000 --pitch_guidance True --rvc_version v2 --epoch 32000

To fix your issues:

  1. Make sure you're using the Generator model file (starts with G_)
  2. Use the final trained model, not intermediate checkpoints
  3. The --model_name parameter is required to specify where to save the extracted model

If you want to automatically find and extract models from the logs directory, that would require modifying the code - it's not currently a built-in feature.