Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo running issues :AttributeError: 'HParams' object has no attribute 'symbols' #290

Open
yjl66djd opened this issue Aug 2, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@yjl66djd
Copy link

yjl66djd commented Aug 2, 2024

1
When i try to run this code block ,meet a AttributeError.I tried updating TensorFlow, but it didn't work.

Copy link

dosubot bot commented Aug 2, 2024

Hey @yjl66djd, I'm here to help you out with the issue you're facing. Let's work on solving this together!

The AttributeError: 'HParams' object has no attribute 'symbols' occurs because the hparams object lacks the symbols attribute. To resolve this, ensure that your configuration file includes the symbols attribute. Here is an example configuration:

{
  "symbols": ["a", "b", "c", ...],  // Add all necessary symbols here
  "data": {
    "filter_length": 1024,
    "n_speakers": 10,
    "text_cleaners": ["english_cleaners"],
    "add_blank": true,
    "sampling_rate": 22050
  },
  "model": {
    // Model-specific parameters
  }
}

Additionally, you can modify the OpenVoiceBaseClass initialization to set a default value for symbols:

class OpenVoiceBaseClass(object):
    def __init__(self, config_path, device='cuda:0'):
        if 'cuda' in device:
            assert torch.cuda.is_available()

        hps = utils.get_hparams_from_file(config_path)
        
        # Ensure hps.symbols is defined
        if not hasattr(hps, 'symbols'):
            hps.symbols = []

        model = SynthesizerTrn(
            len(hps.symbols),
            hps.data.filter_length // 2 + 1,
            n_speakers=hps.data.n_speakers,
            **hps.model,
        ).to(device)

        model.eval()
        self.model = model
        self.hps = hps
        self.device = device

This ensures hps.symbols is always defined, preventing the AttributeError [1].

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the bug Something isn't working label Aug 2, 2024
@yjl66djd
Copy link
Author

yjl66djd commented Aug 2, 2024

@dosu After the change, the error message became AttributeError: 'HParams' object has no attribute 'text_cleaners',This change seems to be treating the symptoms rather than the root cause.

Copy link

dosubot bot commented Aug 2, 2024

To resolve the AttributeError: 'HParams' object has no attribute 'text_cleaners', ensure that the text_cleaners attribute is defined in your configuration file. Here is an example configuration:

{
  "symbols": ["a", "b", "c", ...],  // Add all necessary symbols here
  "data": {
    "text_cleaners": ["english_cleaners"],
    "filter_length": 1024,
    "hop_length": 256,
    "win_length": 1024,
    "sampling_rate": 22050,
    "n_speakers": 10,
    "add_blank": true
  },
  "model": {
    // Model-specific parameters
  }
}

Ensure that the text_cleaners attribute is correctly defined and matches the expected format. This should resolve the AttributeError [1][2].

To continue talking to Dosu, mention @dosu.

@fury88
Copy link

fury88 commented Sep 8, 2024

@dosu, AttributeError: module 'openvoice.text.cleaners' has no attribute 'english_cleaners'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants