google-research / big_vision

Official codebase used to develop Vision Transformer, SigLIP, MLP-Mixer, LiT and more.
Apache License 2.0
2.16k stars 147 forks source link

AttributeError pp_img in lit notebook #18

Closed amrzv closed 1 year ago

amrzv commented 1 year ago

Hi. An AttributeError is raised when running big_vision/blob/main/big_vision/configs/proj/image_text/lit.ipynb notebook in colab:

image

P.S: raised here config.pp_img. P.S.S: here also will be AttributeError: config.pp_txt

gurkirt commented 1 year ago

I am facing the same issue, I solved the pp_img but pp_txt is still an issue. I set follow configs in lit_coco.py

config.pp_img = f'resize({arg.res})|value_range(-1,1)'
config.pp_txt = 'tokenize(max_len=16, inkey="texts", eos="sticky", pad_value=1)'

Image pp works but for pp_txt I get the following error

image

Looking forward for your response.

bobwan1995 commented 1 year ago

Hi, you can instead use

config.evals.disclf.pp_img & config.evals.disclf.pp_txt

For 'preprocess_ops.tokenize', it's just because you don't register config.pp_modules.

for pp_mod in config.pp_modules: importlib.import_module(f'big_vision.pp.{pp_mod}')

You can restart the session and run again.

Remember to modify 'label': label to 'texts': label as the inkey in config.evals.disclf.pp_txt is 'texts'.