Skip to content

Releases: mistralai/mistral-common

mistral-common v1.2.0

30 May 09:36
Compare
Choose a tag to compare

Fill-in-the-middle (FIM) with [SUFFIX] and [PREFIX] logic is added to allow building code completion workflows such as:

from mistral_inference.model import Transformer
from mistral_inference.generate import generate
from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
from mistral_common.tokens.instruct.request import FIMRequest

tokenizer = MistralTokenizer.v3()
model = Transformer.from_folder("~/codestral-22B-240529")

prefix = """def add("""
suffix = """    return sum"""

request = FIMRequest(prompt=prefix, suffix=suffix)

tokens = tokenizer.encode_fim(request).tokens

out_tokens, _ = generate([tokens], model, max_tokens=256, temperature=0.0, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)
result = tokenizer.decode(out_tokens[0])

middle = result.split(suffix)[0].strip()
print(middle)

mistral-common v1.1.0

29 May 14:26
19ec537
Compare
Choose a tag to compare
  • Adds improved function calling validator
  • Adds improved fine-tuning assistant message