huseinzol05
commited on
Commit
β’
5b523e7
1
Parent(s):
a4b207c
Upload malaysian-mistral-7b-32k-instructions-v4-marlin.ipynb
Browse files
malaysian-mistral-7b-32k-instructions-v4-marlin.ipynb
ADDED
@@ -0,0 +1,428 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
+
"id": "0bd93331",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [],
|
9 |
+
"source": [
|
10 |
+
"# !pip3 install auto-gptq==0.7.1 --no-build-isolation --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/"
|
11 |
+
]
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"cell_type": "code",
|
15 |
+
"execution_count": 17,
|
16 |
+
"id": "218fe424",
|
17 |
+
"metadata": {},
|
18 |
+
"outputs": [],
|
19 |
+
"source": [
|
20 |
+
"# !pip3 install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu118"
|
21 |
+
]
|
22 |
+
},
|
23 |
+
{
|
24 |
+
"cell_type": "code",
|
25 |
+
"execution_count": 2,
|
26 |
+
"id": "3528b6d0",
|
27 |
+
"metadata": {},
|
28 |
+
"outputs": [],
|
29 |
+
"source": [
|
30 |
+
"import json\n",
|
31 |
+
"from transformers import AutoTokenizer\n",
|
32 |
+
"from datasets import Dataset"
|
33 |
+
]
|
34 |
+
},
|
35 |
+
{
|
36 |
+
"cell_type": "code",
|
37 |
+
"execution_count": 3,
|
38 |
+
"id": "e6f97f55",
|
39 |
+
"metadata": {},
|
40 |
+
"outputs": [],
|
41 |
+
"source": [
|
42 |
+
"MAX_SEQ_LEN = 512\n",
|
43 |
+
"NUM_EXAMPLES = 512\n",
|
44 |
+
"\n",
|
45 |
+
"MODEL_ID = \"mesolitica/malaysian-mistral-7b-32k-instructions-v4\"\n",
|
46 |
+
"\n",
|
47 |
+
"tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)"
|
48 |
+
]
|
49 |
+
},
|
50 |
+
{
|
51 |
+
"cell_type": "code",
|
52 |
+
"execution_count": 4,
|
53 |
+
"id": "226d58f6",
|
54 |
+
"metadata": {},
|
55 |
+
"outputs": [],
|
56 |
+
"source": [
|
57 |
+
"with open('sample_code.json') as fopen:\n",
|
58 |
+
" code = json.load(fopen)\n",
|
59 |
+
" \n",
|
60 |
+
"with open('sample_general.json') as fopen:\n",
|
61 |
+
" general = json.load(fopen)\n",
|
62 |
+
" \n",
|
63 |
+
"combined = [{'messages': i} for i in (code + general)]"
|
64 |
+
]
|
65 |
+
},
|
66 |
+
{
|
67 |
+
"cell_type": "code",
|
68 |
+
"execution_count": 5,
|
69 |
+
"id": "58cbe1e4",
|
70 |
+
"metadata": {},
|
71 |
+
"outputs": [
|
72 |
+
{
|
73 |
+
"data": {
|
74 |
+
"text/plain": [
|
75 |
+
"{'messages': [{'content': 'Untuk menterjemahkan keterangan fungsi Python ke dalam bahasa Melayu dan mengubahnya menjadi Swift, mari kita fokus pada kedua-dua aspek tersebut:\\n\\nPenerangan dalam Bahasa Melayu:\\n\\n1. Tentukan sama ada terdapat subset biasa di antara semua susunan.\\n2. Cari subset bersama yang terpanjang di antara n susunan.\\n\\nKod dalam Swift boleh ditulis seperti di bawah:\\n\\n```swift\\nfunc isCommonSubsequence(sequences: [String]) -> Bool {\\n \"\"\" Tentukan sama ada terdapat subset biasa di antara semua susunan \"\"\"\\n // Pelaksanaan Swift\\n return false\\n}\\n\\nfunc findCommonSequenceN(sequences: [String]) -> String? {\\n \"\"\" Cari subset bersama yang terpanjang di antara n susunan \"\"\"\\n // Pelaksanaan Swift\\n return nil\\n}\\n```\\n\\nPerlu diingat, Swift menggunakan camelCase untuk menamakan fungsi yang berbeza dengan snake_case yang digunakan dalam Python. Jadi, nama fungsi seperti `is_common_subsequence` menjadi `isCommonSubsequence` dan `find_common_sequence_n` menjadi `findCommonSequenceN` dalam Swift.\\n\\nPelaksanaan dalaman fungsi-fungsi ini bergantung pada algoritma yang anda ingin gunakan, dan kodnya belum lengkap kerana ia hanya mengandungi rangka kerja fungsi dengan ulasan yang telah diterjemahkan. Anda perlu mengisi logik sebenar di dalamnya untuk mereka berfungsi.',\n",
|
76 |
+
" 'role': 'user'},\n",
|
77 |
+
" {'content': 'Untuk menterjemahkan keterangan fungsi Python ke dalam bahasa Melayu dan kemudian mengubahnya menjadi fungsi dalam Swift, pertama sekali, mari kita mulakan dengan menterjemahkan keterangan fungsi ke dalam bahasa Melayu. Kemudian, kita akan membuat contoh kod fungsi dalam Swift.\\n\\nKeterangan dalam Bahasa Melayu:\\n\\n1. \"Tentukan sama ada terdapat subsusunan biasa di antara semua susunan.\" - Fungsi ini perlu menentukan sama ada terdapat subsusunan yang muncul dalam setiap susunan yang diberikan sebagai parameter.\\n\\n2. \"Cari subsusunan bersama terpanjang di antara n susunan.\" - Fungsi ini bertujuan untuk mencari subsusunan terpanjang yang hadir dalam semua susunan yang diberikan.\\n\\nSekarang, mari kita ubah kedua-dua keterangan ini menjadi fungsi dalam Swift:\\n\\n```swift\\nfunc adakahSubsusunanBiasaDalamSemuaSusunan(susunan: [String]) -> Bool {\\n // Keterangan: Tentukan sama ada terdapat subsusunan biasa di antara semua susunan.\\n // Logik untuk melaksanakan fungsi di sini.\\n\\n return false // Hanya nilai pemegang tempat, perlu diganti dengan logik sebenar.\\n}\\n\\nfunc cariSubsusunanBersamaTerpanjangDalamN(susunan: [String]) -> String? {\\n // Keterangan: Cari subsusunan bersama terpanjang di antara n susunan.\\n // Logik untuk melaksanakan fungsi di sini.\\n\\n return nil // Hanya nilai pemegang tempat, perlu diganti dengan logik sebenar.\\n}\\n```\\n\\nUntuk menambahkan logik yang diperlukan dalam fungsi-fungsi di atas dalam Swift, anda perlu menerapkan algoritma yang sesuai, seperti menggunakan algoritma Longest Common Subsequence (LCS) untuk mencari subsusunan bersama terpanjang atau melakukan pemeriksaan secara bersilang (brute force) untuk menentukan sama ada subsusunan biasa wujud dalam semua susunan.\\n\\nDi atas adalah kerangka asas fungsi tanpa pelaksanaan penuh. Untuk melengkapkan fungsi sepenuhnya, anda perlu mengisi logik yang dikehendaki dalam setiap fungsi. Jika anda memerlukan bantuan untuk membina logik fungsi tersebut, anda boleh meminta contoh kod yang lebih khusus.',\n",
|
78 |
+
" 'role': 'assistant'}]}"
|
79 |
+
]
|
80 |
+
},
|
81 |
+
"execution_count": 5,
|
82 |
+
"metadata": {},
|
83 |
+
"output_type": "execute_result"
|
84 |
+
}
|
85 |
+
],
|
86 |
+
"source": [
|
87 |
+
"dataset = Dataset.from_list(combined)\n",
|
88 |
+
"dataset[0]"
|
89 |
+
]
|
90 |
+
},
|
91 |
+
{
|
92 |
+
"cell_type": "code",
|
93 |
+
"execution_count": 6,
|
94 |
+
"id": "8a319bd8",
|
95 |
+
"metadata": {
|
96 |
+
"scrolled": true
|
97 |
+
},
|
98 |
+
"outputs": [
|
99 |
+
{
|
100 |
+
"data": {
|
101 |
+
"application/vnd.jupyter.widget-view+json": {
|
102 |
+
"model_id": "69fe9d5d905b499bbd1af7f113840609",
|
103 |
+
"version_major": 2,
|
104 |
+
"version_minor": 0
|
105 |
+
},
|
106 |
+
"text/plain": [
|
107 |
+
"Map: 0%| | 0/1000 [00:00<?, ? examples/s]"
|
108 |
+
]
|
109 |
+
},
|
110 |
+
"metadata": {},
|
111 |
+
"output_type": "display_data"
|
112 |
+
}
|
113 |
+
],
|
114 |
+
"source": [
|
115 |
+
"def preprocess(example):\n",
|
116 |
+
" return {\"text\": tokenizer.apply_chat_template(example[\"messages\"], tokenize=False)}\n",
|
117 |
+
"\n",
|
118 |
+
"ds = dataset.map(preprocess)"
|
119 |
+
]
|
120 |
+
},
|
121 |
+
{
|
122 |
+
"cell_type": "code",
|
123 |
+
"execution_count": 7,
|
124 |
+
"id": "ea7d4319",
|
125 |
+
"metadata": {},
|
126 |
+
"outputs": [],
|
127 |
+
"source": [
|
128 |
+
"examples = [\n",
|
129 |
+
" tokenizer(\n",
|
130 |
+
" example[\"text\"], padding=False, max_length=MAX_SEQ_LEN, truncation=True,\n",
|
131 |
+
" ) for example in ds\n",
|
132 |
+
"]"
|
133 |
+
]
|
134 |
+
},
|
135 |
+
{
|
136 |
+
"cell_type": "code",
|
137 |
+
"execution_count": 8,
|
138 |
+
"id": "c8766644",
|
139 |
+
"metadata": {
|
140 |
+
"scrolled": true
|
141 |
+
},
|
142 |
+
"outputs": [
|
143 |
+
{
|
144 |
+
"name": "stderr",
|
145 |
+
"output_type": "stream",
|
146 |
+
"text": [
|
147 |
+
"huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...\n",
|
148 |
+
"To disable this warning, you can either:\n",
|
149 |
+
"\t- Avoid using `tokenizers` before the fork if possible\n",
|
150 |
+
"\t- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)\n"
|
151 |
+
]
|
152 |
+
},
|
153 |
+
{
|
154 |
+
"name": "stdout",
|
155 |
+
"output_type": "stream",
|
156 |
+
"text": [
|
157 |
+
"auto_gptq==0.7.1+cu118\r\n"
|
158 |
+
]
|
159 |
+
}
|
160 |
+
],
|
161 |
+
"source": [
|
162 |
+
"!pip3 freeze | grep gptq"
|
163 |
+
]
|
164 |
+
},
|
165 |
+
{
|
166 |
+
"cell_type": "code",
|
167 |
+
"execution_count": 9,
|
168 |
+
"id": "fea9813e",
|
169 |
+
"metadata": {
|
170 |
+
"scrolled": true
|
171 |
+
},
|
172 |
+
"outputs": [],
|
173 |
+
"source": [
|
174 |
+
"from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig"
|
175 |
+
]
|
176 |
+
},
|
177 |
+
{
|
178 |
+
"cell_type": "code",
|
179 |
+
"execution_count": null,
|
180 |
+
"id": "496eef42",
|
181 |
+
"metadata": {},
|
182 |
+
"outputs": [],
|
183 |
+
"source": [
|
184 |
+
"quantize_config = BaseQuantizeConfig(\n",
|
185 |
+
" bits=4, # Only support 4 bit\n",
|
186 |
+
" group_size=128, # Set to g=128 or -1 (for channelwise)\n",
|
187 |
+
" desc_act=False, # Marlin does not support act_order=True\n",
|
188 |
+
" model_file_base_name=\"model\", # Name of the model.safetensors when we call save_pretrained\n",
|
189 |
+
")\n",
|
190 |
+
"\n",
|
191 |
+
"model = AutoGPTQForCausalLM.from_pretrained(\n",
|
192 |
+
" MODEL_ID,\n",
|
193 |
+
" quantize_config,\n",
|
194 |
+
" device_map=\"auto\")"
|
195 |
+
]
|
196 |
+
},
|
197 |
+
{
|
198 |
+
"cell_type": "code",
|
199 |
+
"execution_count": null,
|
200 |
+
"id": "9a55aa59",
|
201 |
+
"metadata": {},
|
202 |
+
"outputs": [],
|
203 |
+
"source": [
|
204 |
+
"model.quantize(examples)"
|
205 |
+
]
|
206 |
+
},
|
207 |
+
{
|
208 |
+
"cell_type": "code",
|
209 |
+
"execution_count": 10,
|
210 |
+
"id": "1332e296",
|
211 |
+
"metadata": {},
|
212 |
+
"outputs": [],
|
213 |
+
"source": [
|
214 |
+
"gptq_save_dir = f\"{MODEL_ID.split('/')[-1]}-gptq\""
|
215 |
+
]
|
216 |
+
},
|
217 |
+
{
|
218 |
+
"cell_type": "code",
|
219 |
+
"execution_count": null,
|
220 |
+
"id": "49cd85b3",
|
221 |
+
"metadata": {},
|
222 |
+
"outputs": [],
|
223 |
+
"source": [
|
224 |
+
"print(f\"Saving gptq model to {gptq_save_dir}\")\n",
|
225 |
+
"model.save_pretrained(gptq_save_dir)\n",
|
226 |
+
"tokenizer.save_pretrained(gptq_save_dir)"
|
227 |
+
]
|
228 |
+
},
|
229 |
+
{
|
230 |
+
"cell_type": "code",
|
231 |
+
"execution_count": null,
|
232 |
+
"id": "617e99d1",
|
233 |
+
"metadata": {},
|
234 |
+
"outputs": [],
|
235 |
+
"source": [
|
236 |
+
"import gc\n",
|
237 |
+
"del model\n",
|
238 |
+
"gc.collect()"
|
239 |
+
]
|
240 |
+
},
|
241 |
+
{
|
242 |
+
"cell_type": "code",
|
243 |
+
"execution_count": 11,
|
244 |
+
"id": "c1ed6b5e",
|
245 |
+
"metadata": {},
|
246 |
+
"outputs": [
|
247 |
+
{
|
248 |
+
"name": "stderr",
|
249 |
+
"output_type": "stream",
|
250 |
+
"text": [
|
251 |
+
"WARNING - ignoring unknown parameter in quantize_config.json: quant_method.\n",
|
252 |
+
"INFO - The layer lm_head is not quantized.\n",
|
253 |
+
"Repacking weights to be compatible with Marlin kernel...: 100%|ββββββββββ| 454/454 [00:32<00:00, 14.18it/s]\n",
|
254 |
+
"The safetensors archive passed at malaysian-mistral-7b-32k-instructions-v4-gptq/autogptq_model.safetensors does not contain metadata. Make sure to save your model with the `save_pretrained` method. Defaulting to 'pt' metadata.\n",
|
255 |
+
"WARNING - you are using save_pretrained, which will re-direct to save_quantized.\n"
|
256 |
+
]
|
257 |
+
},
|
258 |
+
{
|
259 |
+
"name": "stdout",
|
260 |
+
"output_type": "stream",
|
261 |
+
"text": [
|
262 |
+
"Saving model in marlin format to malaysian-mistral-7b-32k-instructions-v4-marlin\n"
|
263 |
+
]
|
264 |
+
},
|
265 |
+
{
|
266 |
+
"data": {
|
267 |
+
"text/plain": [
|
268 |
+
"('malaysian-mistral-7b-32k-instructions-v4-marlin/tokenizer_config.json',\n",
|
269 |
+
" 'malaysian-mistral-7b-32k-instructions-v4-marlin/special_tokens_map.json',\n",
|
270 |
+
" 'malaysian-mistral-7b-32k-instructions-v4-marlin/tokenizer.json')"
|
271 |
+
]
|
272 |
+
},
|
273 |
+
"execution_count": 11,
|
274 |
+
"metadata": {},
|
275 |
+
"output_type": "execute_result"
|
276 |
+
}
|
277 |
+
],
|
278 |
+
"source": [
|
279 |
+
"marlin_model = AutoGPTQForCausalLM.from_quantized(\n",
|
280 |
+
" gptq_save_dir,\n",
|
281 |
+
" use_marlin=True,\n",
|
282 |
+
" device_map=\"auto\")\n",
|
283 |
+
"\n",
|
284 |
+
"marlin_save_dir = f\"{MODEL_ID.split('/')[-1]}-marlin\"\n",
|
285 |
+
"print(f\"Saving model in marlin format to {marlin_save_dir}\")\n",
|
286 |
+
"marlin_model.save_pretrained(marlin_save_dir)\n",
|
287 |
+
"tokenizer.save_pretrained(marlin_save_dir) "
|
288 |
+
]
|
289 |
+
},
|
290 |
+
{
|
291 |
+
"cell_type": "code",
|
292 |
+
"execution_count": 13,
|
293 |
+
"id": "097144a0",
|
294 |
+
"metadata": {
|
295 |
+
"scrolled": true
|
296 |
+
},
|
297 |
+
"outputs": [
|
298 |
+
{
|
299 |
+
"name": "stdout",
|
300 |
+
"output_type": "stream",
|
301 |
+
"text": [
|
302 |
+
"total 3.9G\r\n",
|
303 |
+
"-rw-r--r-- 1 ubuntu ubuntu 1023 Apr 26 06:27 config.json\r\n",
|
304 |
+
"-rw-r--r-- 1 ubuntu ubuntu 3.9G Apr 26 06:27 model.safetensors\r\n",
|
305 |
+
"-rw-r--r-- 1 ubuntu ubuntu 311 Apr 26 06:27 quantize_config.json\r\n",
|
306 |
+
"-rw-r--r-- 1 ubuntu ubuntu 625 Apr 26 06:27 special_tokens_map.json\r\n",
|
307 |
+
"-rw-r--r-- 1 ubuntu ubuntu 1.8M Apr 26 06:27 tokenizer.json\r\n",
|
308 |
+
"-rw-r--r-- 1 ubuntu ubuntu 1.5K Apr 26 06:27 tokenizer_config.json\r\n"
|
309 |
+
]
|
310 |
+
},
|
311 |
+
{
|
312 |
+
"name": "stderr",
|
313 |
+
"output_type": "stream",
|
314 |
+
"text": [
|
315 |
+
"huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...\n",
|
316 |
+
"To disable this warning, you can either:\n",
|
317 |
+
"\t- Avoid using `tokenizers` before the fork if possible\n",
|
318 |
+
"\t- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)\n"
|
319 |
+
]
|
320 |
+
}
|
321 |
+
],
|
322 |
+
"source": [
|
323 |
+
"!ls -lh {marlin_save_dir}"
|
324 |
+
]
|
325 |
+
},
|
326 |
+
{
|
327 |
+
"cell_type": "code",
|
328 |
+
"execution_count": 14,
|
329 |
+
"id": "1dffb40b",
|
330 |
+
"metadata": {},
|
331 |
+
"outputs": [],
|
332 |
+
"source": [
|
333 |
+
"from huggingface_hub import HfApi\n",
|
334 |
+
"\n",
|
335 |
+
"hf = HfApi()"
|
336 |
+
]
|
337 |
+
},
|
338 |
+
{
|
339 |
+
"cell_type": "code",
|
340 |
+
"execution_count": 15,
|
341 |
+
"id": "cb13a971",
|
342 |
+
"metadata": {},
|
343 |
+
"outputs": [
|
344 |
+
{
|
345 |
+
"data": {
|
346 |
+
"text/plain": [
|
347 |
+
"RepoUrl('https://huggingface.co/mesolitica/malaysian-mistral-7b-32k-instructions-v4-marlin', endpoint='https://huggingface.co', repo_type='model', repo_id='mesolitica/malaysian-mistral-7b-32k-instructions-v4-marlin')"
|
348 |
+
]
|
349 |
+
},
|
350 |
+
"execution_count": 15,
|
351 |
+
"metadata": {},
|
352 |
+
"output_type": "execute_result"
|
353 |
+
}
|
354 |
+
],
|
355 |
+
"source": [
|
356 |
+
"final_model_name = f\"{MODEL_ID}-marlin\"\n",
|
357 |
+
"hf.create_repo(final_model_name)"
|
358 |
+
]
|
359 |
+
},
|
360 |
+
{
|
361 |
+
"cell_type": "code",
|
362 |
+
"execution_count": 16,
|
363 |
+
"id": "2833b0bb",
|
364 |
+
"metadata": {},
|
365 |
+
"outputs": [
|
366 |
+
{
|
367 |
+
"data": {
|
368 |
+
"application/vnd.jupyter.widget-view+json": {
|
369 |
+
"model_id": "fa29fe2795884ccfb13e6bdc4a93eca0",
|
370 |
+
"version_major": 2,
|
371 |
+
"version_minor": 0
|
372 |
+
},
|
373 |
+
"text/plain": [
|
374 |
+
"model.safetensors: 0%| | 0.00/4.13G [00:00<?, ?B/s]"
|
375 |
+
]
|
376 |
+
},
|
377 |
+
"metadata": {},
|
378 |
+
"output_type": "display_data"
|
379 |
+
},
|
380 |
+
{
|
381 |
+
"data": {
|
382 |
+
"text/plain": [
|
383 |
+
"CommitInfo(commit_url='https://huggingface.co/mesolitica/malaysian-mistral-7b-32k-instructions-v4-marlin/commit/a4b207c443baeb89e1d0419921cfc969d1acb362', commit_message='Upload folder using huggingface_hub', commit_description='', oid='a4b207c443baeb89e1d0419921cfc969d1acb362', pr_url=None, pr_revision=None, pr_num=None)"
|
384 |
+
]
|
385 |
+
},
|
386 |
+
"execution_count": 16,
|
387 |
+
"metadata": {},
|
388 |
+
"output_type": "execute_result"
|
389 |
+
}
|
390 |
+
],
|
391 |
+
"source": [
|
392 |
+
"hf.upload_folder(\n",
|
393 |
+
" folder_path=marlin_save_dir,\n",
|
394 |
+
" repo_id=final_model_name,\n",
|
395 |
+
")"
|
396 |
+
]
|
397 |
+
},
|
398 |
+
{
|
399 |
+
"cell_type": "code",
|
400 |
+
"execution_count": null,
|
401 |
+
"id": "3dc45104",
|
402 |
+
"metadata": {},
|
403 |
+
"outputs": [],
|
404 |
+
"source": []
|
405 |
+
}
|
406 |
+
],
|
407 |
+
"metadata": {
|
408 |
+
"kernelspec": {
|
409 |
+
"display_name": "Python 3 (ipykernel)",
|
410 |
+
"language": "python",
|
411 |
+
"name": "python3"
|
412 |
+
},
|
413 |
+
"language_info": {
|
414 |
+
"codemirror_mode": {
|
415 |
+
"name": "ipython",
|
416 |
+
"version": 3
|
417 |
+
},
|
418 |
+
"file_extension": ".py",
|
419 |
+
"mimetype": "text/x-python",
|
420 |
+
"name": "python",
|
421 |
+
"nbconvert_exporter": "python",
|
422 |
+
"pygments_lexer": "ipython3",
|
423 |
+
"version": "3.10.12"
|
424 |
+
}
|
425 |
+
},
|
426 |
+
"nbformat": 4,
|
427 |
+
"nbformat_minor": 5
|
428 |
+
}
|