Skip to content

bert

Classes

fastvideo.models.encoders.bert.HunyuanClip

HunyuanClip(model_dir, max_length=77)

Bases: Module

Hunyuan clip code copied from https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/hunyuandit/pipeline_hunyuandit.py hunyuan's clip used BertModel and BertTokenizer, so we copy it.

Source code in fastvideo/models/encoders/bert.py
def __init__(self, model_dir, max_length=77):
    super().__init__()

    self.max_length = max_length
    self.tokenizer = BertTokenizer.from_pretrained(
        os.path.join(model_dir, 'tokenizer'))
    self.text_encoder = BertModel.from_pretrained(
        os.path.join(model_dir, 'clip_text_encoder'))