From d31d889bbb035b2856d675d1bf3a73e08ba28216 Mon Sep 17 00:00:00 2001 From: Jintao Date: Fri, 28 Jun 2024 14:28:12 +0800 Subject: [PATCH] Support gemma2 (#1248) --- requirements/framework.txt | 2 +- swift/llm/utils/template.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/framework.txt b/requirements/framework.txt index 70f4c5cc6..05a49bbcf 100644 --- a/requirements/framework.txt +++ b/requirements/framework.txt @@ -15,6 +15,6 @@ rouge safetensors tensorboard tqdm -transformers>=4.33,<4.42 +transformers>=4.33,<4.43 transformers_stream_generator trl>=0.9.4 diff --git a/swift/llm/utils/template.py b/swift/llm/utils/template.py index 8b7df2812..980b152ee 100644 --- a/swift/llm/utils/template.py +++ b/swift/llm/utils/template.py @@ -279,13 +279,13 @@ def add_default_tags(self, example: Dict[str, Any]) -> None: def encode(self, example: Dict[str, Any]) -> Tuple[Dict[str, Any], Dict[str, Any]]: """return: inputs, tokenizer_kwargs""" - example = example.copy() if not self._is_init: raise ValueError( 'Template is not initialized, please use the `get_template` function to obtain the template.') if example.get('images') and not isinstance(example['images'], (tuple, list)): # change images field to list example['images'] = [example['images']] + example = example.copy() self.add_default_tags(example) self.check_example(example) if example.get('objects') and isinstance(example['objects'], str):