Skip to content

everyvoice rename-speaker ( old speaker name defaults and error messages ) #728

@marctessier

Description

@marctessier

Bug description

When we run :

everyvoice rename-speaker
or soon after PR722
everyvoice checkpoint rename-speaker

It expects the second argument to be the old speaker name and it is required.

If you give it a wrong speaker name , we get a kind of ungraceful error message. with " ValueError: Speaker 'SPEAKER' not found in parameters. at the end.

I think instead we should capture the error and display the list of speaker names in the model and a proper error message instead of displaying code in the message. Also, I think it should be an command line Option instead with a default of none. If no old speaker name is given and the model is a single speaker model it will assume that is what you want to rename without the need to specify the single speaker name.

The help current help message says this below below:

 everyvoice checkpoint rename-speaker -h
                                                                                             
 Usage: everyvoice checkpoint rename-speaker [OPTIONS] MODEL_PATH                            
                                             OLD_SPEAKER_NAME NEW_SPEAKER_NAME               
                                                                                             
 Rename a speaker in the checkpoint's parameters.                                            
                                                                                             
                                                                                             
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────╮
│ *    model_path            FILE  The path to your model checkpoint file.                  │
│                                  [default: None]                                          │
│                                  [required]                                               │
│ *    old_speaker_name      TEXT  The name of the speaker to rename.                       │
│                                  [default: None]                                          │
│                                  [required]                                               │
│ *    new_speaker_name      TEXT  The new name for the speaker.                            │
│                                  [default: None]                                          │
│                                  [required]                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────────────────╮
│ --help  -h        Show this message and exit.                                             │
╰───────────────────────────────────────────────────────────────────────────────────────────╯


How to reproduce the bug

everyvoice checkpoint rename-speaker ./last.ckpt old new

Error messages and logs

everyvoice checkpoint rename-speaker ./last.ckpt old new
╭─────────────────────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────────────────────╮
│ /gpfs/fs5/nrc/nrc-fs1/ict/others/u/tes001/TxT2SPEECH/EveryVoice_722/everyvoice/base_cli/checkpoint.py:221 in rename_speaker             │
│                                                                                                                                         │
│   218 │   │   │   torch.save(ckpt, model_path)                                                                                          │
│   219 │   │   │   print(f"Updated checkpoint saved to {model_path}.")                                                                   │
│   220 │   │   else:                                                                                                                     │
│ ❱ 221 │   │   │   raise ValueError(f"Speaker '{old_speaker_name}' not found in parameters.")                                            │
│   222 │                                                                                                                                 │
│   223 │   else:                                                                                                                         │
│   224 │   │   raise ValueError("No speakers found in checkpoint parameters.")                                                           │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: Speaker 'old' not found in parameters.

Environment

Details latest

More info

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions