Skip to content

Support intern-s1 #14875

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

RunningLeon
Copy link
Contributor

@github-actions github-actions bot added the python python script changes label Jul 25, 2025
@CISC
Copy link
Collaborator

CISC commented Jul 29, 2025

The Python Type-Check CI needs to be resolved.

@RunningLeon
Copy link
Contributor Author

The Python Type-Check CI needs to be resolved.

@CISC hi, could you tell how to fix this error? Seems not reasonable to me

/home/runner/work/llama.cpp/llama.cpp/convert_hf_to_gguf.py:3219:23 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
Error: Object of type "None" is not subscriptable (reportOptionalSubscript)
/home/runner/work/llama.cpp/llama.cpp/convert_hf_to_gguf.py:3220:13 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
Error: Object of type "None" is not subscriptable (reportOptionalSubscript)
/home/runner/work/llama.cpp/llama.cpp/convert_hf_to_gguf.py:3220:49 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
Error: Object of type "None" is not subscriptable (reportOptionalSubscript)
/home/runner/work/llama.cpp/llama.cpp/convert_hf_to_gguf.py:32[21](https://github.com/ggml-org/llama.cpp/actions/runs/16612224904/job/46997396567?pr=14875#step:5:22):23 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
Error: Object of type "None" is not subscriptable (reportOptionalSubscript)
/home/runner/work/llama.cpp/llama.cpp/convert_hf_to_gguf.py:3[22](https://github.com/ggml-org/llama.cpp/actions/runs/16612224904/job/46997396567?pr=14875#step:5:23)2:13 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
Error: Object of type "None" is not subscriptable (reportOptionalSubscript)
/home/runner/work/llama.cpp/llama.cpp/convert_hf_to_gguf.py:3222:49 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
Error: Object of type "None" is not subscriptable (reportOptionalSubscript)
6 errors, 0 warnings, 14 informations
Error: 6 errors

@CISC
Copy link
Collaborator

CISC commented Jul 30, 2025

The Python Type-Check CI needs to be resolved.

@CISC hi, could you tell how to fix this error? Seems not reasonable to me

Running pyright locally helps, the line numbers are wrong for some reason, this is the actual erroneous codeblock:

if isinstance(self.hparams_vision['image_size'], list):
self.hparams_vision['image_size'] = self.hparams_vision['image_size'][0]
if isinstance(self.hparams_vision['patch_size'], list):
self.hparams_vision['patch_size'] = self.hparams_vision['patch_size'][0]

self._set_vocab_gpt2()

def _set_vocab_interns1(self):
tokens, toktypes, tokpre = self.get_vocab_base()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work because Intern-S1 requires custom code, you must handle that here and not call base class get_vocab_base.

The Intern-S1 tokenizer looks like it's fairly special, so I think it requires custom handling to work as intended, not just using AutoTokenizer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CISC Hi, thanks for your reminder. Indeed, the intern-s1 tokenizer is special. It bases on Qwen3 bpe tokenizer, and expands with three spm tokenizer models. It uses some regex patterns to match to which sub vocab to use when tokenizing. Don't know how to implement it in llama.cpp. Do you have any suggestion for this special case? THX

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No easy feat I'm afraid, SMILES especially, you will have to add a special case for it to do the sub-vocab matching and implement tokenizer in llama-vocab.cpp.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. After consideration, the sub-vocab feat would be not added in this PR.

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

Successfully merging this pull request may close these issues.

3 participants