Skip to content

Commit 60e1015

Browse files
committed
tested chat template, changed some parameters
1 parent 8a2395a commit 60e1015

1 file changed

Lines changed: 6 additions & 17 deletions

File tree

llama_cpp/llama_chat_format.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4467,7 +4467,6 @@ def __init__(
44674467
self,
44684468
force_reasoning: bool = False,
44694469
add_vision_id: bool = True,
4470-
image_min_tokens: int = -1,
44714470
**kwargs,
44724471
):
44734472
"""
@@ -4478,20 +4477,13 @@ def __init__(
44784477
- add_vision_id (bool):
44794478
- True (default): Count all the images. Recommended for multi-image.
44804479
- False: Doesn't count the images. Can save tokens with single-image.
4481-
- image_min_tokens (int):
4482-
It only takes effect when the value is greater than zero. the default value is -1 (i.e., using the default parameters in the model's preprocessor_config.json).
4483-
Note: Qwen-VL models require at minimum 1024 image tokens to function correctly on bbox grounding tasks
44844480
"""
4485-
self.force_reasoning = force_reasoning
4486-
self.add_vision_id = add_vision_id
4487-
self.image_min_tokens = image_min_tokens
4481+
super().__init__(**kwargs)
44884482

4489-
super().__init__(image_min_tokens=self.image_min_tokens, **kwargs)
4483+
self.extra_template_arguments["force_reasoning"] = force_reasoning
4484+
self.extra_template_arguments["add_vision_id"] = add_vision_id
44904485

44914486
def __call__(self, **kwargs):
4492-
self.extra_template_arguments["force_reasoning"] = self.force_reasoning
4493-
self.extra_template_arguments["add_vision_id"] = self.add_vision_id
4494-
44954487
llama = kwargs['llama']
44964488

44974489
if hasattr(llama, 'input_ids'):
@@ -4698,15 +4690,12 @@ def __init__(
46984690
- True (default): Count all the images. Recommended for multi-image.
46994691
- False: Doesn't count the images. Can save tokens with single-image.
47004692
"""
4701-
self.reasoning = reasoning
4702-
self.add_vision_id = add_vision_id
4703-
47044693
super().__init__(**kwargs)
47054694

4706-
def __call__(self, **kwargs):
4707-
self.extra_template_arguments["enable_thinking"] = self.reasoning
4708-
self.extra_template_arguments["add_vision_id"] = self.add_vision_id
4695+
self.extra_template_arguments["enable_thinking"] = reasoning
4696+
self.extra_template_arguments["add_vision_id"] = add_vision_id
47094697

4698+
def __call__(self, **kwargs):
47104699
llama = kwargs['llama']
47114700

47124701
# Clear state for multiple runs

0 commit comments

Comments
 (0)