mathstral-7B-v0.1

我要开发同款
匿名用户2024年07月31日
21阅读
开发技术mistral、pytorch
所属分类ai
开源地址https://modelscope.cn/models/AI-ModelScope/mathstral-7B-v0.1
授权协议apache-2.0

作品详情

Model Card for Mathstral-7B-v0.1

Mathstral 7B is a model specializing in mathematical and scientific tasks, based on Mistral 7B. You can read more in the official blog post.

Installation

It is recommended to use mistralai/mathstral-7B-v0.1 with mistral-inference

pip install mistral_inference>=1.2.0

Download

from huggingface_hub import snapshot_download
from pathlib import Path

mistral_models_path = Path.home().joinpath('mistral_models', 'mathstral-7B-v0.1')
mistral_models_path.mkdir(parents=True, exist_ok=True)

snapshot_download(repo_id="mistralai/mathstral-7B-v0.1", allow_patterns=["params.json", "consolidated.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)

Chat

After installing mistral_inference, a mistral-demo CLI command should be available in your environment.

mistral-chat $HOME/mistral_models/mathstral-7B-v0.1 --instruct --max_tokens 256

You can then start chatting with the model, e.g. prompt it with something like:

"Albert likes to surf every week. Each surfing session lasts for 4 hours and costs $20 per hour. How much would Albert spend in 5 weeks?"

Usage in transformers

To use this model within the transformers library, install the latest release with pip install --upgrade transformers and run, for instance:

from transformers import MistralForCausalLM
from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained('mistralai/mathstral-7B-v0.1')

prompt = "What are the roots of unity?"
tokenized_prompts = tokenizer(prompt, return_tensors="pt") 

model = MistralForCausalLM.from_pretrained('mistralai/mathstral-7B-v0.1')
generation = model.generate(**tokenized_prompts, max_new_tokens=512)
print(tokenizer.decode(generation[0]))
>>> """<s>What are the roots of unity?

The roots of unity are the solutions to the equation $z^n = 1$, where $n$ is a positive integer.
These roots are complex numbers and they form a regular $n$-gon in the complex plane.

For example, the roots of unity for $n=1$ are just $1$,
and for $n=2$ they are $1$ and $-1$. For $n=3$, they are $1$, $\\frac{-1+\\sqrt{3}i}{2}$, and $\\frac{-1-\\sqrt{3}i}{2}$.

The roots of unity have many interesting properties and they are used in many areas of mathematics, including number theory, algebra, and geometry.</s>"""

Evaluation

We evaluate Mathstral 7B and open-weight models of the similar size on industry-standard benchmarks.

Benchmarks MATH GSM8K (8-shot) Odyssey Math maj@16 GRE Math maj@16 AMC 2023 maj@16 AIME 2024 maj@16
Mathstral 7B 56.6 77.1 37.2 56.9 42.4 2/30
DeepSeek Math 7B 44.4 80.6 27.6 44.6 28.0 0/30
Llama3 8B 28.4 75.4 24.0 26.2 34.4 0/30
GLM4 9B 50.2 48.8 18.9 46.2 36.0 1/30
QWen2 7B 56.8 32.7 24.8 58.5 35.2 2/30
Gemma2 9B 48.3 69.5 18.6 52.3 31.2 1/30

The Mistral AI Team

Albert Jiang, Alexandre Sablayrolles, Alexis Tacnet, Alok Kothari, Antoine Roux, Arthur Mensch, Audrey Herblin-Stoop, Augustin Garreau, Austin Birky, Bam4d, Baptiste Bout, Baudouin de Monicault, Blanche Savary, Carole Rambaud, Caroline Feldman, Devendra Singh Chaplot, Diego de las Casas, Eleonore Arcelin, Emma Bou Hanna, Etienne Metzger, Gaspard Blanchet, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Harizo Rajaona, Henri Roussez, Hichem Sattouf, Ian Mack, Jean-Malo Delignon, Jessica Chudnovsky, Justus Murke, Kartik Khandelwal, Lawrence Stewart, Louis Martin, Louis Ternon, Lucile Saulnier, Lélio Renard Lavaud, Margaret Jennings, Marie Pellat, Marie Torelli, Marie-Anne Lachaux, Marjorie Janiewicz, Mickaël Seznec, Nicolas Schuhl, Niklas Muhs, Olivier de Garrigues, Patrick von Platen, Paul Jacob, Pauline Buche, Pavan Kumar Reddy, Perry Savas, Pierre Stock, Romain Sauvestre, Sagar Vaze, Sandeep Subramanian, Saurabh Garg, Sophia Yang, Szymon Antoniak, Teven Le Scao, Thibault Schueller, Thibaut Lavril, Thomas Wang, Théophile Gervet, Timothée Lacroix, Valera Nemychnikova, Wendy Shang, William El Sayed, William Marshall

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论