Views
No views yet
mistralai/Mistral-7B-v0.3 with mistral-inference. For HF transformers code snippets, please keep scrolling.pip install mistral_inference1from huggingface_hub import snapshot_download
2from pathlib import Path
3
4mistral_models_path = Path.home().joinpath('mistral_models', '7B-v0.3')
5mistral_models_path.mkdir(parents=True, exist_ok=True)
6
7snapshot_download(repo_id="mistralai/Mistral-7B-v0.3", allow_patterns=["params.json", "consolidated.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)mistral_inference, a mistral-demo CLI command should be available in your environment.mistral-demo $HOME/mistral_models/7B-v0.3This is a test of the emergency broadcast system. This is only a test.
If this were a real emergency, you would be told what to do.
This is a test
=====================
This is another test of the new blogging software. I’m not sure if I’m going to keep it or not. I’m not sure if I’m going to keep
=====================
This is a third test, mistral AI is very good at testing. 🙂
This is a third test, mistral AI is very good at testing. 🙂
This
=====================transformerstransformers to generate text, you can do something like this.1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_id = "mistralai/Mistral-7B-v0.3"
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5
6model = AutoModelForCausalLM.from_pretrained(model_id)
7inputs = tokenizer("Hello my name is", return_tensors="pt")
8
9outputs = model.generate(**inputs, max_new_tokens=20)
10print(tokenizer.decode(outputs[0], skip_special_tokens=True))