sophiamyang commited on
Commit
cfba6cf
·
verified ·
1 Parent(s): 02a8ecb

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -2
README.md CHANGED
@@ -322,13 +322,16 @@ from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
322
  from mistral_common.protocol.instruct.messages import UserMessage, TextChunk, ImageURLChunk
323
  from mistral_common.protocol.instruct.request import ChatCompletionRequest
324
 
325
- tokenizer = MistralTokenizer.from_file(f"{mistral_models_path}/tokenizer.model.v7")
326
  model = Transformer.from_folder(mistral_models_path)
327
 
328
  url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/yosemite.png"
329
  prompt = "Describe the image."
330
 
331
- completion_request = ChatCompletionRequest(messages=[UserMessage(content=[ImageURLChunk(image_url=url), TextChunk(text=prompt)])])
 
 
 
332
 
333
  encoded = tokenizer.encode_chat_completion(completion_request)
334
 
 
322
  from mistral_common.protocol.instruct.messages import UserMessage, TextChunk, ImageURLChunk
323
  from mistral_common.protocol.instruct.request import ChatCompletionRequest
324
 
325
+ tokenizer = MistralTokenizer.v7().instruct_tokenizer
326
  model = Transformer.from_folder(mistral_models_path)
327
 
328
  url = "https://huggingface.co/datasets/patrickvonplaten/random_img/resolve/main/yosemite.png"
329
  prompt = "Describe the image."
330
 
331
+ completion_request = ChatCompletionRequest(messages=[
332
+ SystemMessage(content=SYSTEM_PROMPT)
333
+ UserMessage(content=[ImageURLChunk(image_url=url), TextChunk(text=prompt)])
334
+ ])
335
 
336
  encoded = tokenizer.encode_chat_completion(completion_request)
337