[CI/Build] Fix lint errors in mistral tokenizer (#9504)

This commit is contained in:
Cyrus Leung 2024-10-19 00:09:35 +08:00 committed by GitHub
parent 25aeb7d4c9
commit 1bbbcc0b1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,11 +2,11 @@ import os
import re
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union, cast
from huggingface_hub import HfApi, hf_hub_download
from mistral_common.protocol.instruct.request import ChatCompletionRequest
# yapf: disable
from mistral_common.tokens.tokenizers.mistral import ChatCompletionRequest
from mistral_common.tokens.tokenizers.mistral import (
MistralTokenizer as PublicMistralTokenizer)
# yapf: enable
@ -166,7 +166,7 @@ class MistralTokenizer:
tools: Optional[Dict[str, Any]] = None,
**kwargs) -> List[int]:
last_message = messages[-1]
last_message = cast(Dict[str, Any], messages[-1])
if last_message["role"] == "assistant":
last_message["prefix"] = True