unum-cloud/uform

README example now invalid

Closed this issue · 5 comments

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'

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

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

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

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

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