Skip to content

Commit

Permalink
Support gemma2 (#1248)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jintao-Huang authored Jun 28, 2024
1 parent bd420f2 commit d31d889
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion requirements/framework.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion swift/llm/utils/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d31d889

Please sign in to comment.