Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue Loading UI-TARS-7B-SFT Model Due to Unrecognized Qwen2VLConfig #44

Open
Andrew821667 opened this issue Feb 7, 2025 · 1 comment

Comments

@Andrew821667
Copy link

Hello UI-TARS Team,

I am encountering an issue while attempting to load the UI-TARS-7B-SFT model using the Hugging Face Transformers library. My goal is to run the model on CPU, and I have included the parameter trust_remote_code=True to allow for loading custom configurations. Below is the code I am using:


from transformers import AutoTokenizer, AutoModelForCausalLM

Load the tokenizer with remote code trust enabled

tokenizer = AutoTokenizer.from_pretrained("bytedance-research/UI-TARS-7B-SFT", trust_remote_code=True)

Load the model with device_map set to "cpu" and trust_remote_code enabled

model = AutoModelForCausalLM.from_pretrained("bytedance-research/UI-TARS-7B-SFT", device_map="cpu", trust_remote_code=True)

prompt = (
"You are a GUI agent. You are given a task: change the header on the page. "
"Please perform the following steps: find the element with the text 'Old Header' and replace it with 'New Header'."
)

inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=100)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(result)

However, when I run this script, I get the following error:


ValueError: Unrecognized configuration class <class 'transformers.models.qwen2_vl.configuration_qwen2_vl.Qwen2VLConfig'> for this kind of AutoModel: AutoModelForCausalLM.
Model type should be one of AriaTextConfig, BambaConfig, BartConfig, BertConfig, … (etc.)

I have updated my Transformers library to the latest version and cleared the Hugging Face cache, but the error persists. It seems that the custom configuration class Qwen2VLConfig is not recognized by AutoModelForCausalLM.

Could you please advise on the correct method to load the UI-TARS-7B-SFT model with its custom configuration? Is there an alternative initialization method that I should use?

Thank you for your assistance.

Best regards,
Andrew

@AHEADer
Copy link
Contributor

AHEADer commented Feb 14, 2025

Maybe you can try to upgrade your transformers version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants