Description
1. Typo: self.econder — src/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
Description
1. Typo:
self.econder—src/vision_language.pyline 65Should be
self.encoder. This is used consistently (self.econderthroughout), so it works, but it's confusing for anyone reading the code and will cause issues if someone triesmodel.encoder.2. Hardcoded magic number for question mark token —
src/utils.pyline ~123The token ID
4042is hardcoded for the question mark character. This breaks if using a different tokenizer/vocab. Should usetokenizer.convert_tokens_to_ids('?')or pass it as a parameter.3.
assert type(...) is not Nonealways passes —src/vision_language.pyline ~301type(x)returns a type object (e.g.,<class 'NoneType'>), which is neverNone. This assertion always passes. Should be:Why It Matters