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

Merged
merged 6 commits into from
Aug 7, 2025
Merged

Support intern-s1 #14875

merged 6 commits into from
Aug 7, 2025

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]

Comment on lines +3208 to +3211
try:
self._set_vocab_sentencepiece()
except FileNotFoundError:
self._set_vocab_gpt2()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
try:
self._set_vocab_sentencepiece()
except FileNotFoundError:
self._set_vocab_gpt2()
super().set_vocab()

Comment on lines +3259 to +3272
special_tokens_map_file = self.dir_model / 'special_tokens_map.json'
additional_special_tokens = []
if special_tokens_map_file.is_file():
with open(special_tokens_map_file, encoding = 'utf-8') as f:
additional_special_tokens = json.load(f).get('additional_special_tokens', [])
tokenizer_cfg_file = self.dir_model / 'special_tokens_map.json'
if tokenizer_cfg_file.is_file():
with open(tokenizer_cfg_file, encoding = 'utf-8') as f:
added_tokens_decoder = json.load(f).get('added_tokens_decoder', {})
token2ids_map = {data['content'] : int(token) for token, data in added_tokens_decoder.items() if data['special']}
for token in additional_special_tokens:
if token in token2ids_map:
special_vocab._set_special_token(token, token2ids_map[token])
special_vocab._set_special_token('eos', 151645)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
special_tokens_map_file = self.dir_model / 'special_tokens_map.json'
additional_special_tokens = []
if special_tokens_map_file.is_file():
with open(special_tokens_map_file, encoding = 'utf-8') as f:
additional_special_tokens = json.load(f).get('additional_special_tokens', [])
tokenizer_cfg_file = self.dir_model / 'special_tokens_map.json'
if tokenizer_cfg_file.is_file():
with open(tokenizer_cfg_file, encoding = 'utf-8') as f:
added_tokens_decoder = json.load(f).get('added_tokens_decoder', {})
token2ids_map = {data['content'] : int(token) for token, data in added_tokens_decoder.items() if data['special']}
for token in additional_special_tokens:
if token in token2ids_map:
special_vocab._set_special_token(token, token2ids_map[token])
special_vocab._set_special_token('eos', 151645)

@CISC
Copy link
Collaborator

CISC commented Aug 7, 2025

Can merge after changes and @ngxson approves.

@ngxson ngxson merged commit 99acbc9 into ggml-org:master Aug 7, 2025
6 checks passed
@CISC
Copy link
Collaborator

CISC commented Aug 7, 2025

Hmmm, after changes... :)

@ngxson
Copy link
Collaborator

ngxson commented Aug 7, 2025

woops sorry I missed that part. I guest @RunningLeon you need to open a new PR then

the-phobos pushed a commit to the-phobos/llama.cpp that referenced this pull request Aug 7, 2025
* support internvl

* support interns1

* resolve comments

* put interns1 in tensor mapping

* resolve comment

* move tokenizer changes to sub class
the-phobos pushed a commit to the-phobos/llama.cpp that referenced this pull request Aug 7, 2025
* support internvl

* support interns1

* resolve comments

* put interns1 in tensor mapping

* resolve comment

* move tokenizer changes to sub class
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