Skip to content

🐛 Bug: Typo 'econder' instead of 'encoder' + hardcoded magic number 4042 for question mark token #5

Description

@vietanhrs

Description

1. Typo: self.econdersrc/vision_language.py line 65

self.econder = RobertaEncoder(config)

Should be self.encoder. This is used consistently (self.econder throughout), so it works, but it's confusing for anyone reading the code and will cause issues if someone tries model.encoder.

2. Hardcoded magic number for question mark token — src/utils.py line ~123

question_mark_index = (output[0] == 4042).nonzero(as_tuple=True)[0][0]

The token ID 4042 is hardcoded for the question mark character. This breaks if using a different tokenizer/vocab. Should use tokenizer.convert_tokens_to_ids('?') or pass it as a parameter.

3. assert type(...) is not None always passes — src/vision_language.py line ~301

assert type(self.__image_input_cache__) is not None

type(x) returns a type object (e.g., <class 'NoneType'>), which is never None. This assertion always passes. Should be:

assert self.__image_input_cache__ is not None

Why It Matters

  • The typo makes code maintenance harder
  • Magic numbers break portability
  • The broken assertion means the cache-empty check never catches the error it was designed for

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions