Skip to content

about padding token #161

@shixishi

Description

@shixishi

in src/flux/modules/conditioner.py
class HFEmbedder(nn.Module):
def init(self, version: str, max_length: int, **hf_kwargs):
xxxx
def forward(self, text: list[str]) -> Tensor:
batch_encoding = self.tokenizer(
text,
truncation=True,
max_length=self.max_length,
return_length=False,
return_overflowing_tokens=False,
padding="max_length",
return_tensors="pt",
)

    outputs = self.hf_module(
        input_ids=batch_encoding["input_ids"].to(self.hf_module.device),
        attention_mask=None,
        output_hidden_states=False,
    )
    return outputs[self.output_key]

in forward() function, when we call self.hf_module to encode the text prompt, why don't we pass attention_mask to handle the padding token?

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