mav23 commited on
Commit
746dc34
1 Parent(s): 463a01e

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,20 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ mathstral-7b-v0.1.Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
37
+ mathstral-7b-v0.1.Q3_K.gguf filter=lfs diff=lfs merge=lfs -text
38
+ mathstral-7b-v0.1.Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
39
+ mathstral-7b-v0.1.Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
40
+ mathstral-7b-v0.1.Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
41
+ mathstral-7b-v0.1.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
42
+ mathstral-7b-v0.1.Q4_1.gguf filter=lfs diff=lfs merge=lfs -text
43
+ mathstral-7b-v0.1.Q4_K.gguf filter=lfs diff=lfs merge=lfs -text
44
+ mathstral-7b-v0.1.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
45
+ mathstral-7b-v0.1.Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
46
+ mathstral-7b-v0.1.Q5_0.gguf filter=lfs diff=lfs merge=lfs -text
47
+ mathstral-7b-v0.1.Q5_1.gguf filter=lfs diff=lfs merge=lfs -text
48
+ mathstral-7b-v0.1.Q5_K.gguf filter=lfs diff=lfs merge=lfs -text
49
+ mathstral-7b-v0.1.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
50
+ mathstral-7b-v0.1.Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
51
+ mathstral-7b-v0.1.Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
52
+ mathstral-7b-v0.1.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+
4
+ extra_gated_description: If you want to learn more about how we process your personal data, please read our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
5
+ ---
6
+
7
+ # Model Card for Mathstral-7b-v0.1
8
+
9
+ Mathstral 7B is a model specializing in mathematical and scientific tasks, based on Mistral 7B.
10
+ You can read more in the [official blog post](https://mistral.ai/news/mathstral/).
11
+
12
+ ## Installation
13
+
14
+ It is recommended to use `mistralai/Mathstral-7b-v0.1` with [mistral-inference](https://github.com/mistralai/mistral-inference)
15
+
16
+
17
+ ```
18
+ pip install mistral_inference>=1.2.0
19
+ ```
20
+
21
+
22
+ ## Download
23
+
24
+ ```py
25
+ from huggingface_hub import snapshot_download
26
+ from pathlib import Path
27
+
28
+ mistral_models_path = Path.home().joinpath('mistral_models', 'Mathstral-7b-v0.1')
29
+ mistral_models_path.mkdir(parents=True, exist_ok=True)
30
+
31
+ snapshot_download(repo_id="mistralai/Mathstral-7b-v0.1", allow_patterns=["params.json", "consolidated.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)
32
+ ```
33
+
34
+ ### Chat
35
+
36
+ After installing `mistral_inference`, a `mistral-demo` CLI command should be available in your environment.
37
+
38
+ ```
39
+ mistral-chat $HOME/mistral_models/Mathstral-7b-v0.1 --instruct --max_tokens 256
40
+ ```
41
+
42
+ You can then start chatting with the model, *e.g.* prompt it with something like:
43
+
44
+
45
+ *"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?"*
46
+
47
+ ### Usage in `transformers`
48
+
49
+ To use this model within the `transformers` library, install the latest release with `pip install --upgrade transformers` and run, for instance:
50
+
51
+ ```py
52
+ from transformers import pipeline
53
+ import torch
54
+
55
+ checkpoint = "mistralai/Mathstral-7b-v0.1"
56
+ pipe = pipeline("text-generation", checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
57
+
58
+ prompt = [{"role": "user", "content": "What are the roots of unity?"}]
59
+ out = pipe(prompt, max_new_tokens = 512)
60
+
61
+ print(out[0]['generated_text'][-1])
62
+ >>> "{'role': 'assistant', 'content': ' The roots of unity are the complex numbers that satisfy the equation $z^n = 1$, where $n$ is a positive integer. These roots are evenly spaced around the unit circle in the complex plane, and they have a variety of interesting properties and applications in mathematics and physics.'}"
63
+ ```
64
+
65
+ You can also manually tokenize the input and generate text from the model, rather than using the higher-level pipeline:
66
+
67
+ ```py
68
+ from transformers import AutoTokenizer, AutoModelForCausalLM
69
+ import torch
70
+
71
+ checkpoint = "mistralai/Mathstral-7b-v0.1"
72
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
73
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
74
+
75
+ prompt = [{"role": "user", "content": "What are the roots of unity?"}]
76
+ tokenized_prompt = tokenizer.apply_chat_template(prompt, add_generation_prompt=True, return_dict=True, return_tensors="pt").to(model.device)
77
+
78
+ out = model.generate(**tokenized_prompt, max_new_tokens=512)
79
+ tokenizer.decode(out[0])
80
+ >>> '<s>[INST] What are the roots of unity?[/INST] The roots of unity are the complex numbers that satisfy the equation $z^n = 1$, where $n$ is a positive integer. These roots are evenly spaced around the unit circle in the complex plane, and they have a variety of interesting properties and applications in mathematics and physics.</s>'
81
+ ```
82
+
83
+ ## Evaluation
84
+ We evaluate Mathstral 7B and open-weight models of the similar size on industry-standard benchmarks.
85
+ | Benchmarks | MATH | GSM8K (8-shot) | Odyssey Math maj@16 | GRE Math maj@16 | AMC 2023 maj@16 | AIME 2024 maj@16
86
+ | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
87
+ | Mathstral 7B | **56.6** | 77.1 | **37.2** | 56.9 | **42.4** | **2/30** |
88
+ | DeepSeek Math 7B | 44.4 | **80.6** | 27.6 | 44.6 | 28.0 | 0/30 |
89
+ | Llama3 8B | 28.4 | 75.4 | 24.0 | 26.2 | 34.4 | 0/30 |
90
+ | GLM4 9B | 50.2 | 48.8 | 18.9 | 46.2 | 36.0 | 1/30 |
91
+ | QWen2 7B | **56.8** | 32.7 | 24.8 | **58.5** | 35.2 | **2/30** |
92
+ | Gemma2 9B | 48.3 | 69.5 | 18.6 | 52.3 | 31.2 | 1/30 |
93
+
94
+
95
+ ## The Mistral AI Team
96
+
97
+ 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
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": ".",
3
+ "architectures": [
4
+ "MistralForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 1,
8
+ "eos_token_id": 2,
9
+ "hidden_act": "silu",
10
+ "hidden_size": 4096,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 14336,
13
+ "max_position_embeddings": 32768,
14
+ "model_type": "mistral",
15
+ "num_attention_heads": 32,
16
+ "num_hidden_layers": 32,
17
+ "num_key_value_heads": 8,
18
+ "rms_norm_eps": 1e-05,
19
+ "rope_theta": 1000000.0,
20
+ "sliding_window": null,
21
+ "tie_word_embeddings": false,
22
+ "torch_dtype": "float32",
23
+ "transformers_version": "4.43.0.dev0",
24
+ "use_cache": true,
25
+ "vocab_size": 32768
26
+ }
mathstral-7b-v0.1.Q2_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7509ef40506523a0642d071bdc488146c4f9cfec986c69563e7a55a5bc00b287
3
+ size 2722878304
mathstral-7b-v0.1.Q3_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57f2d25e42e2c45fcf2b1267c134291848365b9613b4b79409928184ace86d19
3
+ size 3522941792
mathstral-7b-v0.1.Q3_K_L.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ffeb04367ae63403cc5bf024d212bc8a99060099183e55d26af40543f2ee45d
3
+ size 3825980256
mathstral-7b-v0.1.Q3_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57f2d25e42e2c45fcf2b1267c134291848365b9613b4b79409928184ace86d19
3
+ size 3522941792
mathstral-7b-v0.1.Q3_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed93f596fd8f1c5c905e4ec5515f60d220387b6ec729dcaf125db4fb7811af7e
3
+ size 3168523104
mathstral-7b-v0.1.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ddaf2d040cde99e9cfd8fb31567028fec58cf637146a985fa0ed344d4f24debd
3
+ size 4113290080
mathstral-7b-v0.1.Q4_1.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb5aa38f007b9a9037444a264256f2a3ee65884b191f26a3096b7b68f28bd2f8
3
+ size 4557886304
mathstral-7b-v0.1.Q4_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5106f13e49fc7b1b91b2339a983790bb768fdba2e9a10a59082acfb726b9a6bb
3
+ size 4372812640
mathstral-7b-v0.1.Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5106f13e49fc7b1b91b2339a983790bb768fdba2e9a10a59082acfb726b9a6bb
3
+ size 4372812640
mathstral-7b-v0.1.Q4_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:66670a704fb27855ba853b56154d2824438a5761de9683deebea2205f01864ab
3
+ size 4144747360
mathstral-7b-v0.1.Q5_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8743d53e853c2d7b399611856c303d3ba37779e2aee26c6670e6bb24d4fe5ff3
3
+ size 5002482528
mathstral-7b-v0.1.Q5_1.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a34c7365fa47dfd661141b05b1ece36ac471a4aca3651fcbd57f59e5dfb3b982
3
+ size 5447078752
mathstral-7b-v0.1.Q5_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0c14bc45d9af7a7089b79f3a3cfc78563dcc5cb524cd9ab1cfa90450354e3ad
3
+ size 5136175968
mathstral-7b-v0.1.Q5_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0c14bc45d9af7a7089b79f3a3cfc78563dcc5cb524cd9ab1cfa90450354e3ad
3
+ size 5136175968
mathstral-7b-v0.1.Q5_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b08a4f73140d1abddd0602e6801b34510a99712bad987772db3536ee8e87e99d
3
+ size 5002482528
mathstral-7b-v0.1.Q6_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32e6e406af478bb606d26687da937735f53843074ca6757e82e002ecd1d44951
3
+ size 5947249504
mathstral-7b-v0.1.Q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f9aca067443805607ee3410e6cb4335bb22f530d1e5762bc17de776d8226633
3
+ size 7702565728