Skip to content

Commit

Permalink
fix template example copy (modelscope#1003)
Browse files Browse the repository at this point in the history
  • Loading branch information
tastelikefeet committed May 25, 2024
1 parent a3cdd99 commit df3e228
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion swift/llm/utils/template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) Alibaba, Inc. and its affiliates.
import re
from copy import deepcopy
from copy import copy, deepcopy
from io import BytesIO
from typing import Any, Dict, List, Literal, Optional, Tuple, Union

Expand Down Expand Up @@ -222,6 +222,7 @@ def encode(self, example: Dict[str, Any]) -> Tuple[Dict[str, Any], Dict[str, Any
if not self._is_init:
raise ValueError(
'Template is not initialized, please use the `get_template` function to obtain the template.')
example = copy(example)
query: Optional[str] = example.pop('query', None)
response: Optional[str] = example.pop('response', None)
history: Optional[History] = example.pop('history', None)
Expand Down

0 comments on commit df3e228

Please sign in to comment.