content-vec-best / README.md
lengyue233's picture
First model version
16b7417
|
raw
history blame
773 Bytes
metadata
license: mit

Content Vec Best

Official Repo: ContentVec
This repo brings fairseq ContentVec model to HuggingFace Transformers.

How to use

To use this model, you need to define

class HubertModelWithFinalProj(HubertModel):
    def __init__(self, config):
        super().__init__(config)

        self.final_proj = nn.Linear(config.hidden_size, config.classifier_proj_size)

and then load the model with

model = HubertModelWithFinalProj.from_pretrained("lengyue233/content-vec-best")

x = model(audio)["last_hidden_state"]
x = model.final_proj(x)

How to convert

You need to download the ContentVec_legacy model from the official repo, and then run

python convert.py