nazimali commited on
Commit
025aedd
1 Parent(s): 98082e1

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - mistralai/Mistral-7B-v0.3
4
+ datasets:
5
+ - wikimedia/wikipedia
6
+ - FreedomIntelligence/alpaca-gpt4-arabic
7
+ language:
8
+ - ar
9
+ - en
10
+ license: apache-2.0
11
+ tags:
12
+ - text-generation-inference
13
+ - transformers
14
+ - unsloth
15
+ - mistral
16
+ - trl
17
+ ---
18
+
19
+ Experimenting with pre-training Arabic language + finetuning on instructions using the quantized model `mistralai/Mistral-7B-v0.3` from `unsloth`. First time trying pre-training, expect issues and low quality outputs. The repo contains the merged, quantized model and GGUF format.
20
+
21
+ ### Example usage
22
+
23
+ #### llama-cpp-python
24
+
25
+ ```python
26
+ from llama_cpp import Llama
27
+
28
+ inference_prompt = """فيما يلي تعليمات تصف مهمة. اكتب استجابة تكمل الطلب بشكل مناسب.
29
+
30
+ ### تعليمات:
31
+ {}
32
+
33
+ ### إجابة:
34
+ """
35
+
36
+ llm = Llama.from_pretrained(
37
+ repo_id="nazimali/mistral-7b-v0.3-instruct-arabic",
38
+ filename="gguf/Q4_K_M.gguf",
39
+ )
40
+
41
+ llm.create_chat_completion(
42
+ messages = [
43
+ {
44
+ "role": "user",
45
+ "content": inference_prompt.format("السلام عليكم، هيا نموء")
46
+ }
47
+ ]
48
+ )
49
+ ```
50
+
51
+ #### llama.cpp
52
+
53
+ ```shell
54
+ ./llama-cli \
55
+ --hf-repo "nazimali/mistral-7b-v0.3-instruct-arabic" \
56
+ --hf-file gguf/Q4_K_M.gguf \
57
+ -p "السلام عليكم، هيا نموء" \
58
+ --conversation
59
+ ```
60
+
61
+ ### Training
62
+
63
+ #### Pre-training data:
64
+
65
+ - `wikimedia/wikipedia`
66
+ - `20231101.ar`
67
+ - Used 6,096 rows, 0.05% of the total data
68
+
69
+ #### Finetuning data:
70
+
71
+ - `FreedomIntelligence/alpaca-gpt4-arabic`
72
+ - Used 49,969 rows, 100% of all the data
73
+
74
+ #### Finetuning instruction format:
75
+
76
+ ```python
77
+ finetune_prompt = """فيما يلي تعليمات تصف مهمة. اكتب استجابة تكمل الطلب بشكل مناسب.
78
+
79
+ ### تعليمات:
80
+ {}
81
+
82
+ ### إجابة:
83
+ """
84
+ ```
config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "unsloth/mistral-7b-v0.3-bnb-4bit",
3
+ "architectures": [
4
+ "MistralForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 1,
8
+ "eos_token_id": 2,
9
+ "head_dim": 128,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 4096,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 14336,
14
+ "max_position_embeddings": 32768,
15
+ "model_type": "mistral",
16
+ "num_attention_heads": 32,
17
+ "num_hidden_layers": 32,
18
+ "num_key_value_heads": 8,
19
+ "pad_token_id": 770,
20
+ "quantization_config": {
21
+ "bnb_4bit_compute_dtype": "bfloat16",
22
+ "bnb_4bit_quant_storage": "uint8",
23
+ "bnb_4bit_quant_type": "nf4",
24
+ "bnb_4bit_use_double_quant": true,
25
+ "llm_int8_enable_fp32_cpu_offload": false,
26
+ "llm_int8_has_fp16_weight": false,
27
+ "llm_int8_skip_modules": null,
28
+ "llm_int8_threshold": 6.0,
29
+ "load_in_4bit": true,
30
+ "load_in_8bit": false
31
+ },
32
+ "rms_norm_eps": 1e-05,
33
+ "rope_theta": 1000000.0,
34
+ "sliding_window": null,
35
+ "tie_word_embeddings": false,
36
+ "torch_dtype": "float16",
37
+ "transformers_version": "4.45.0",
38
+ "unsloth_version": "2024.9",
39
+ "use_cache": true,
40
+ "vocab_size": 32768
41
+ }
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "max_length": 32768,
6
+ "pad_token_id": 770,
7
+ "transformers_version": "4.45.0"
8
+ }
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef3c5d6ad99e755a61f5e7b651e2d28baa5a441be87bd1774dc2171abe4b2250
3
+ size 1978231989
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2192f79a6a31651ef12609244d15226594123cf7a75455fa56ba5cce7d849d86
3
+ size 1891601745
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:135f10d914b4d44036fb7fd159a6e91e65e7be916d0c5cc30456a3ba752184fd
3
+ size 268435584
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,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
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:37f00374dea48658ee8f5d0f21895b9bc55cb0103939607c8185bfd1c6ca1f89
3
+ size 587404
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff