Skip to content

Offline usage? #60

@George0828Zhang

Description

@George0828Zhang

Tried to load model locally using this:

def load_vocos(path, device):
    config_path = os.path.join(path, 'config.yaml')
    model_path = os.path.join(path, 'pytorch_model.bin')
    model = Vocos.from_hparams(config_path)
    state_dict = torch.load(model_path, map_location="cpu")
    if isinstance(model.feature_extractor, EncodecFeatures):
        encodec_parameters = {
            "feature_extractor.encodec." + key: value
            for key, value in model.feature_extractor.encodec.state_dict().items()
        }
        state_dict.update(encodec_parameters)
    model.load_state_dict(state_dict)
    model.eval()
    model.to(device)
    return model

However, this line is hard-coded to load pretrained encodec, preventing offline usage:

self.encodec = encodec(pretrained=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions