MLX
Safetensors
mistral

Upload folder using huggingface_hub

#1
README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - fr
5
+ - de
6
+ - es
7
+ - it
8
+ - pt
9
+ - zh
10
+ - ja
11
+ - ru
12
+ - ko
13
+ license: other
14
+ tags:
15
+ - mlx
16
+ license_name: mrl
17
+ license_link: https://mistral.ai/licenses/MRL-0.1.md
18
+ extra_gated_description: If you want to learn more about how we process your personal
19
+ data, please read our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
20
+ ---
21
+
22
+ # mlx-community/Mistral-Large-Instruct-2407-8bit
23
+
24
+ The Model [mlx-community/Mistral-Large-Instruct-2407-8bit](https://huggingface.co/mlx-community/Mistral-Large-Instruct-2407-8bit) was converted to MLX format from [mistralai/Mistral-Large-Instruct-2407](https://huggingface.co/mistralai/Mistral-Large-Instruct-2407) using mlx-lm version **0.16.1**.
25
+
26
+ ## Use with mlx
27
+
28
+ ```bash
29
+ pip install mlx-lm
30
+ ```
31
+
32
+ ```python
33
+ from mlx_lm import load, generate
34
+
35
+ model, tokenizer = load("mlx-community/Mistral-Large-Instruct-2407-8bit")
36
+ response = generate(model, tokenizer, prompt="hello", verbose=True)
37
+ ```
config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MistralForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 1,
7
+ "eos_token_id": 2,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 12288,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 28672,
12
+ "max_position_embeddings": 32768,
13
+ "model_type": "mistral",
14
+ "num_attention_heads": 96,
15
+ "num_hidden_layers": 88,
16
+ "num_key_value_heads": 8,
17
+ "quantization": {
18
+ "group_size": 64,
19
+ "bits": 8
20
+ },
21
+ "rms_norm_eps": 1e-05,
22
+ "rope_theta": 1000000.0,
23
+ "sliding_window": null,
24
+ "tie_word_embeddings": false,
25
+ "torch_dtype": "bfloat16",
26
+ "transformers_version": "4.42.3",
27
+ "use_cache": true,
28
+ "vocab_size": 32768
29
+ }
model-00001-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b6fe80a964463f8a02a8641548c87643ae2f33564588bea016c0c4910ce7a332
3
+ size 5187462533
model-00002-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:212f1a67d0aa719bdc6ad95d2ca8fd21fc17d17eb7d9606b4c91af8f9b32990b
3
+ size 5160722815
model-00003-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c3dd7adb3282aac8a7fd9142370e294875e2f267d79cbf8904f2a7434cb501b
3
+ size 5134034558
model-00004-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e70aa9834c8b05c6b3a04ef0244747c44c0a0f7577b27f5a828f69acc43550e
3
+ size 5160722860
model-00005-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:600c328fc983a3a8b084e6df3a7198d2a86ff58b3683a376b1a8ae77e475aac6
3
+ size 5134034644
model-00006-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4ea330c2ec9d1151af7c539e35c3ce0e9bd03374a1c86a87b3f4c1253f5df74
3
+ size 5160722866
model-00007-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d36ca0c9b623d1398bf3ec3d7b37458f01c5b0676a9de9146ed92335f4d82c4
3
+ size 5134034640
model-00008-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64c0fe00f95deb023562c3028a2f415479bb93cddca4b8ee133976c2cf4a84c0
3
+ size 5160722906
model-00009-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d5e33d1495bb4b3ad5d2a8bd050dffb28e592e45371c303e9df6a200b74e429f
3
+ size 5134034638
model-00010-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a398aad235943301b1d106d2881505933cac1dcb1777aef59343b0886cb7a8a5
3
+ size 5160722878
model-00011-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f52b27f556784be77ce6cc5905e105138e7ad58bd49baaa10df9046dcfd786b
3
+ size 5134034640
model-00012-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:324fecc8cdc9772a41b87ada2e1a88fe657856e805d53e45097361b711643a7e
3
+ size 5160722870
model-00013-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4f87ce77a0ea4a26207dd28773fc4c89213f61681d717237910c27e6acd3575
3
+ size 5134034648
model-00014-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f2d8392ec985065ec5774d6a3635248e6d7439f295c3e30a21a5e612804227a
3
+ size 5160722894
model-00015-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6f6ee2e8d9c6618e175397fb3a25dbc012e984a4200b9481c0e362074320eca
3
+ size 5134034634
model-00016-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:21de6179d856784fbe1088781894b6df4a0c1dc97b75ee0954de844b7cd9d79b
3
+ size 5160722894
model-00017-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a24eb5a55d9edefa16741a0817a7645ac7e501d0fae327bfc913e61b7502a3dc
3
+ size 5134034640
model-00018-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f866eb38f96b8fc7017856d9854ef09dea2c9ed333bc6be2c1ac9edcb97dbca8
3
+ size 5160722886
model-00019-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1c20323c1fd999b838ceb1bf96d5d28ee8d6c5cf1b637c74e59751fdc27251ef
3
+ size 5134034642
model-00020-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0280930e90bf0eef519208ce9b0e3f50c7f6e34a394b187c95f1fc88ce3022b
3
+ size 5160722886
model-00021-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f88921c970a349956a02c8ead0532c1938fb5260d9d170bd7bf8d3197a086ad7
3
+ size 5134034648
model-00022-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ae3bd64e4e38985d40c52dfa2cc49d724647d931fec27c8f56448b23723a0a6
3
+ size 5160722902
model-00023-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f32f9486306cf10b3b3ec37b0d4f06f73a2258054b4bc102073bccc8ed55417
3
+ size 5134034658
model-00024-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4cd7b6e834301b8ed493493582fcf07a8b30a03d2d118bc12aa14d6b09fdaaa5
3
+ size 5160722906
model-00025-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:35752200c588ac4cc0049fee1697eca85f9876215fdd2aabbd3814da6d66766a
3
+ size 5134034638
model-00026-of-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b0bb18f2d891f92dce325f83e31f33d53400f7da7b9a13e23b6cad2e18fe040
3
+ size 1550919270
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "unk_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
test.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from typing import Dict
3
+
4
+ from safetensors.torch import load_file, save_file
5
+ from huggingface_hub import split_torch_state_dict_into_shards
6
+ import torch
7
+ import os
8
+
9
+ def save_state_dict(state_dict: Dict[str, torch.Tensor], save_directory: str):
10
+ state_dict_split = split_torch_state_dict_into_shards(state_dict, filename_pattern='consolidated{suffix}.safetensors')
11
+ for filename, tensors in state_dict_split.filename_to_tensors.items():
12
+ shard = {tensor: state_dict[tensor] for tensor in tensors}
13
+ print("Saving", save_directory, filename)
14
+ save_file(shard, os.path.join(save_directory, filename))
15
+ if state_dict_split.is_sharded:
16
+ index = {
17
+ "metadata": state_dict_split.metadata,
18
+ "weight_map": state_dict_split.tensor_to_filename,
19
+ }
20
+ with open(os.path.join(save_directory, "consolidated.safetensors.index.json"), "w") as f:
21
+ f.write(json.dumps(index, indent=2))
22
+
23
+ big_file = 'consolidated.safetensors'
24
+ loaded = load_file(big_file)
25
+
26
+ save_state_dict(loaded, save_directory=f'.')
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:59f95e28944c062244741268596badc900df86c7f5ded05088d2da22a7379e06
3
+ size 587583
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff