unum-cloud / uform

Pocket-Sized Multimodal AI for content understanding and generation across multilingual texts, images, and ๐Ÿ”œ video, up to 5x faster than OpenAI CLIP and LLaVA ๐Ÿ–ผ๏ธ & ๐Ÿ–‹๏ธ
https://unum-cloud.github.io/uform/
Apache License 2.0
982 stars 56 forks source link

README example now invalid #69

Closed ppbrown closed 3 months ago

ppbrown commented 4 months ago

I tried running the code in the readme, related to using unum-cloud/uform-gen2-qwen-500m

It doesnt work. I got the following error.

 File "/home/phil/stable-diffusion-experiments/tokenspace/unum/unum2_test.py", line 3, in <module>
    model = AutoModel.from_pretrained("unum-cloud/uform-gen2-qwen-500m", trust_remote_code=True)
  File "/home/phil/stable-diffusion-experiments/venv-scratch/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 561, in from_pretrained
    return model_class.from_pretrained(
  File "/home/phil/stable-diffusion-experiments/venv-scratch/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3462, in from_pretrained
    model = cls(config, *model_args, **model_kwargs)
  File "/home/phil/.cache/huggingface/modules/transformers_modules/unum-cloud/uform-gen2-qwen-500m/3912572ad204f82a2b0f875d3a1700faaebab719/modeling_uform_gen.py", line 63, in __init__
    self.text_config = AutoConfig.from_pretrained(
  File "/home/phil/stable-diffusion-experiments/venv-scratch/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 1098, in from_pretrained
    config_class = CONFIG_MAPPING[config_dict["model_type"]]
  File "/home/phil/stable-diffusion-experiments/venv-scratch/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 795, in __getitem__
    raise KeyError(key)
KeyError: 'qwen2'
ashvardanian commented 4 months ago

Hi @ppbrown! Can you please try upgrading your transformers library? If it works, feel free to patch the notice ๐Ÿค—

ppbrown commented 4 months ago

Ah, thank you. I was on transformers 4.36.2 When I upgraded to 4.38.1, it then continued. Perhaps you might add a "requirements.txt" file that specifies minimum transformers version?

There is, however, another bug. It is missing

from PIL import Image

ashvardanian commented 4 months ago

Yes, it's probably worth upgrading those two in pyproject.toml. Please let me know if you can open a PR, @ppbrown ๐Ÿค—

ppbrown commented 4 months ago

I dont use things like pyproject.toml, so cant test, so not good for me to open PR for it.

ashvardanian commented 4 months ago

@ppbrown, when you pip install uform or pip install -e . for local development - the pyproject.toml file is triggered automatically.