Upload folder using huggingface_hub
#1
by
prince-canuma
- opened
- README.md +37 -0
- config.json +29 -0
- model-00001-of-00014.safetensors +3 -0
- model-00002-of-00014.safetensors +3 -0
- model-00003-of-00014.safetensors +3 -0
- model-00004-of-00014.safetensors +3 -0
- model-00005-of-00014.safetensors +3 -0
- model-00006-of-00014.safetensors +3 -0
- model-00007-of-00014.safetensors +3 -0
- model-00008-of-00014.safetensors +3 -0
- model-00009-of-00014.safetensors +3 -0
- model-00010-of-00014.safetensors +3 -0
- model-00011-of-00014.safetensors +3 -0
- model-00012-of-00014.safetensors +3 -0
- model-00013-of-00014.safetensors +3 -0
- model-00014-of-00014.safetensors +3 -0
- model.safetensors.index.json +0 -0
- special_tokens_map.json +23 -0
- test.py +26 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +0 -0
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-4bit
|
23 |
+
|
24 |
+
The Model [mlx-community/Mistral-Large-Instruct-2407-4bit](https://huggingface.co/mlx-community/Mistral-Large-Instruct-2407-4bit) 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-4bit")
|
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": 4
|
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-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d7a2ca3b4704cd052e1ff2e51debaf2c1e8152c65bf8f4cd6c76c1c937532a48
|
3 |
+
size 5280417162
|
model-00002-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9a8682119076809870897a2f19e2521f0f4f8286cb56e329b412b18f984d7b12
|
3 |
+
size 5252155094
|
model-00003-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ae72c583260c6994e799fff83973c096a88eedaaa72822793221826a6eeb6df0
|
3 |
+
size 5365401350
|
model-00004-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5aa62c510112093c6a95db568b2506220dc0de5da85162f891f681e282f467bd
|
3 |
+
size 5351244918
|
model-00005-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ed987234622b145c3363b65da174b21b5fdac6c3f9e603c399c17025951a46c2
|
3 |
+
size 5252105792
|
model-00006-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d241878e33e1451d465f91652210a3713f221754bdb22c91e6e228d8f4363441
|
3 |
+
size 5252155193
|
model-00007-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:252e43cb13a1451380ee8a0314e0e37df435d75c70acc56e1cc202caf6ca3615
|
3 |
+
size 5252155185
|
model-00008-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0091033c2d48b2febeefb3ddcc86e913d4c6f94dc121e52304d06b6c6f95d77e
|
3 |
+
size 5365401388
|
model-00009-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d2e2865f0e5ddf526b86317e996c55b2a57b2b99febf1a8aa443e99eefc7a19
|
3 |
+
size 5351244930
|
model-00010-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d0d7d7193be28007579409dcf123c605a33c7dc02e5fe7349a5e8d9a9a141b69
|
3 |
+
size 5252105824
|
model-00011-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6a0014cf77c2effc79f2ad43f0580effb2083e2315efcfe8a024d87765be329d
|
3 |
+
size 5252155169
|
model-00012-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:aad725bb51c8122e498d68b5a04bacc7dc66cf0f22876916d2a47515c65e76a8
|
3 |
+
size 5252155163
|
model-00013-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ed1ce4cd8ce45ebc1c92701a1bed4a93f2e03853a763a2692f0fbd184d330a88
|
3 |
+
size 5266334543
|
model-00014-of-00014.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:198cbecacff88979c85cd838d22ff087a5ec71274b839ac28be808e9ff58934e
|
3 |
+
size 226492716
|
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
|
|