Skip to content

reset glmedge chat template #13253

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

Merged
merged 2 commits into from
May 2, 2025
Merged

Conversation

piDack
Copy link
Contributor

@piDack piDack commented May 2, 2025

Make sure to read the contributing guidelines before submitting a PR

Hi, @ngxson,I’d like to know why the glmedge model needs to be added [gMASK]. I tried using the code below, and through testing, I found that the edge model does not exist. I think we shouldn’t add it, right?

from transformers import AutoModelForCausalLM, AutoTokenizer

MODEL_PATH = "<path>"

tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
model = AutoModelForCausalLM.from_pretrained(MODEL_PATH, device_map="auto")

message = [{"role": "user", "content": "hello!"}]

inputs = tokenizer.apply_chat_template(
    message,
    return_tensors="pt",
    add_generation_prompt=True,
    return_dict=True,
).to(model.device)
print(tokenizer.decode(inputs["input_ids"][0],skip_special_tokens=False))

the output is
image

Also, what are the poor performance issues that arise from this?

@github-actions github-actions bot added the testing Everything test related label May 2, 2025
@ngxson
Copy link
Collaborator

ngxson commented May 2, 2025

There is a test in llava/test.sh and without adding gmask, the model never response.

I don't know why but tbh the chat template of glmedge is quite confusing.

Did you tested it (glmedge gguf model with vision input) without gmask?

@piDack
Copy link
Contributor Author

piDack commented May 2, 2025

There is a test in llava/test.sh and without adding gmask, the model never response.

I don't know why but tbh the chat template of glmedge is quite confusing.

Did you tested it (glmedge gguf model with vision input) without gmask?

I feel it’s because of the changes made to BOI and EOI in your other PR #13081. Because in all GLM multimodal models, BOI and EOI are written in the weights rather than using <|begin_of_image|> and <|end_of_image|> tokenid directly https://huggingface.co/THUDM/glm-edge-v-2b/blob/main/siglip.py#L53. This is quite strange, but they indeed do it this way.

@ngxson
Copy link
Collaborator

ngxson commented May 2, 2025

Hmm ok I see, I didn't know about this python code. This is quite messy because all other models use boi/eoi as text token.

I'll bring back the boi/eoi embeddings in a follow up PR

@ngxson
Copy link
Collaborator

ngxson commented May 2, 2025

Btw, I'm not sure wht CI failed, let's try to make it green before merging

@piDack
Copy link
Contributor Author

piDack commented May 2, 2025

Hmm ok I see, I didn't know about this python code. This is quite messy because all other models use boi/eoi as text token.

Yes, I feel the confuse too.

@piDack
Copy link
Contributor Author

piDack commented May 2, 2025

Btw, I'm not sure wht CI failed, let's try to make it green before merging

Ok

@ngxson ngxson merged commit 2af6880 into ggml-org:master May 2, 2025
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Everything test related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants