fahidnasir commited on
Commit
d043425
·
verified ·
1 Parent(s): 03d77db

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,19 +1,17 @@
1
  ---
2
- license: llama3.2
3
  language:
4
- - en
5
  pipeline_tag: text-generation
6
  library_name: mlx
7
  tags:
8
- - mlx
9
- - svg
10
- - code-generation
11
- - graphics
12
- - vector-graphics
13
- - apple-silicon
14
- - llama
15
- base_model:
16
- - meta-llama/Llama-3.2-3B-Instruct
17
  ---
18
 
19
  # SVG-Master
@@ -38,9 +36,9 @@ Built on top of **Llama 3.2 3B Instruct**, this model has been instruction-tuned
38
  | **Base Model** | Llama-3.2-3B-Instruct-4bit |
39
  | **Model Size** | 3.2 Billion Parameters |
40
  | **Fine-tuning Method** | LoRA (QLoRA) |
41
- | **LoRA Config** | 16 layers, Rank 8, Alpha/Scale 20 |
42
- | **Training Data** | 2,000 High-quality SVG/Prompt pairs |
43
- | **Training Steps** | 600 Iterations |
44
  | **Optimizer** | Adam (Learning Rate: 1e-4) |
45
  | **Context Window** | 128k Tokens (Llama 3.2 default) |
46
 
@@ -52,10 +50,10 @@ Designed for Apple Silicon, use `mlx-lm` for the fastest experience.
52
 
53
  ```bash
54
  # Using uv (recommended)
55
- uv run mlx_lm.generate --model ./weights --adapter-path ./adapters --prompt "A minimalist sunset over a calm ocean"
56
 
57
  # Using standard python
58
- python -m mlx_lm.generate --model ./weights --adapter-path ./adapters --prompt "A minimalist sunset over a calm ocean"
59
  ```
60
 
61
  ### 2. Ollama Integration
@@ -77,6 +75,14 @@ response = generate(model, tokenizer, prompt="A golden trophy icon", max_tokens=
77
  print(response)
78
  ```
79
 
 
 
 
 
 
 
 
 
80
  ## 📜 License
81
 
82
  This model inherits the [Llama 3.2 Community License Agreement](https://www.llama.com/llama3_2/license/).
@@ -85,4 +91,4 @@ This model inherits the [Llama 3.2 Community License Agreement](https://www.llam
85
 
86
  - **HuggingFace**: [fahidnasir/SVG-Master](https://huggingface.co/fahidnasir/SVG-Master)
87
  - **Kaggle**: [nfahid/svg-master](https://www.kaggle.com/models/nfahid/svg-master)
88
- - **Ollama**: [fahidnasir/svg-master](https://ollama.com/fahidnasir/svg-master)
 
1
  ---
2
+ license: other
3
  language:
4
+ - en
5
  pipeline_tag: text-generation
6
  library_name: mlx
7
  tags:
8
+ - mlx
9
+ - svg
10
+ - code-generation
11
+ - graphics
12
+ - vector-graphics
13
+ - apple-silicon
14
+ - llama
 
 
15
  ---
16
 
17
  # SVG-Master
 
36
  | **Base Model** | Llama-3.2-3B-Instruct-4bit |
37
  | **Model Size** | 3.2 Billion Parameters |
38
  | **Fine-tuning Method** | LoRA (QLoRA) |
39
+ | **LoRA Config** | 16 layers, Rank 32, Alpha 64 |
40
+ | **Training Data** | 3,000 High-quality SVG/Prompt pairs |
41
+ | **Training Steps** | 2,000 Iterations |
42
  | **Optimizer** | Adam (Learning Rate: 1e-4) |
43
  | **Context Window** | 128k Tokens (Llama 3.2 default) |
44
 
 
50
 
51
  ```bash
52
  # Using uv (recommended)
53
+ uv run mlx_lm.generate --model ./base_weights --adapter-path ./adapters --prompt "A minimalist sunset over a calm ocean"
54
 
55
  # Using standard python
56
+ python -m mlx_lm.generate --model ./base_weights --adapter-path ./adapters --prompt "A minimalist sunset over a calm ocean"
57
  ```
58
 
59
  ### 2. Ollama Integration
 
75
  print(response)
76
  ```
77
 
78
+ ## 📂 Project Structure
79
+
80
+ - `base_weights/`: Original Llama-3.2-3B-Instruct-4bit weights.
81
+ - `adapters/`: Fine-tuned LoRA adapter weights and configuration (Rank 32).
82
+ - `data/`: Cleaned and balanced training/validation datasets.
83
+ - `scripts/`: Automation scripts for training, verification, and export.
84
+ - `weight_fused/`: Fully fused, dequantized GGUF/Safetensors models (for export).
85
+
86
  ## 📜 License
87
 
88
  This model inherits the [Llama 3.2 Community License Agreement](https://www.llama.com/llama3_2/license/).
 
91
 
92
  - **HuggingFace**: [fahidnasir/SVG-Master](https://huggingface.co/fahidnasir/SVG-Master)
93
  - **Kaggle**: [nfahid/svg-master](https://www.kaggle.com/models/nfahid/svg-master)
94
+ - **Ollama**: [fahidnasir/svg-master](https://ollama.com/fahidnasir/svg-master)
adapters/adapter_config.json CHANGED
@@ -1,40 +1,44 @@
1
  {
2
- "adapter_path": "svg-master/adapters",
3
- "batch_size": 4,
4
- "config": null,
5
- "data": "svg-master/data",
6
- "fine_tune_type": "lora",
7
- "grad_accumulation_steps": 1,
8
- "grad_checkpoint": false,
9
- "iters": 600,
10
- "learning_rate": 0.0001,
11
- "lora_parameters": {
12
- "rank": 8,
13
- "dropout": 0.0,
14
- "scale": 20.0
15
- },
16
- "lr_schedule": null,
17
- "mask_prompt": false,
18
- "max_seq_length": 2048,
19
- "model": "mlx-community/Llama-3.2-3B-Instruct-4bit",
20
- "num_layers": 16,
21
- "optimizer": "adam",
22
- "optimizer_config": {
23
- "adam": {},
24
- "adamw": {},
25
- "muon": {},
26
- "sgd": {},
27
- "adafactor": {}
28
- },
29
- "project_name": null,
30
- "report_to": null,
31
- "resume_adapter_file": null,
32
- "save_every": 100,
33
- "seed": 0,
34
- "steps_per_eval": 50,
35
- "steps_per_report": 10,
36
- "test": false,
37
- "test_batches": 500,
38
- "train": true,
39
- "val_batches": 10
40
- }
 
 
 
 
 
1
  {
2
+ "adapter_path": "./adapters",
3
+ "alpha": 64,
4
+ "batch_size": 4,
5
+ "config": "scripts/lora_config.yaml",
6
+ "data": "./data",
7
+ "dropout": 0.05,
8
+ "fine_tune_type": "lora",
9
+ "grad_accumulation_steps": 1,
10
+ "grad_checkpoint": true,
11
+ "iters": 2000,
12
+ "learning_rate": 0.0001,
13
+ "lora_layers": 16,
14
+ "lora_parameters": {
15
+ "rank": 8,
16
+ "dropout": 0.0,
17
+ "scale": 20.0
18
+ },
19
+ "lr_schedule": null,
20
+ "mask_prompt": false,
21
+ "max_seq_length": 2048,
22
+ "model": "./base_weights",
23
+ "num_layers": 16,
24
+ "optimizer": "adam",
25
+ "optimizer_config": {
26
+ "adam": {},
27
+ "adamw": {},
28
+ "muon": {},
29
+ "sgd": {},
30
+ "adafactor": {}
31
+ },
32
+ "project_name": null,
33
+ "rank": 32,
34
+ "report_to": null,
35
+ "resume_adapter_file": null,
36
+ "save_every": 200,
37
+ "seed": 0,
38
+ "steps_per_eval": 200,
39
+ "steps_per_report": 10,
40
+ "test": false,
41
+ "test_batches": 500,
42
+ "train": true,
43
+ "val_batches": 25
44
+ }
adapters/adapters.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2eeea10a717d29f43aa3cf0c30b687d2ef3def8c41d846b693e39cbe1d7ab8a4
3
  size 27811400
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:641f49fc49c01f5cc5c55e17eb7c4976c9bcafb19dbee0d01b759df873ee9c73
3
  size 27811400
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2322764a26305efe30c88e111faf1c00a932bcac0b349a61e7050100e38099b1
3
  size 1807496278
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d75e1ee0ea653cc5b76191ec934c7c0d568e94d4e47846619f1f4bc715b7b265
3
  size 1807496278
model.safetensors.index.json CHANGED
@@ -1,7 +1,6 @@
1
  {
2
  "metadata": {
3
- "total_size": 1807423488,
4
- "total_parameters": 3212749824
5
  },
6
  "weight_map": {
7
  "model.embed_tokens.biases": "model.safetensors",
 
1
  {
2
  "metadata": {
3
+ "total_size": 1807423488
 
4
  },
5
  "weight_map": {
6
  "model.embed_tokens.biases": "model.safetensors",
tokenizer_config.json CHANGED
@@ -2050,6 +2050,7 @@
2050
  }
2051
  },
2052
  "bos_token": "<|begin_of_text|>",
 
2053
  "clean_up_tokenization_spaces": true,
2054
  "eos_token": "<|eot_id|>",
2055
  "extra_special_tokens": {},
 
2050
  }
2051
  },
2052
  "bos_token": "<|begin_of_text|>",
2053
+ "chat_template": "{{- bos_token }}\n{%- if custom_tools is defined %}\n {%- set tools = custom_tools %}\n{%- endif %}\n{%- if not tools_in_user_message is defined %}\n {%- set tools_in_user_message = true %}\n{%- endif %}\n{%- if not date_string is defined %}\n {%- if strftime_now is defined %}\n {%- set date_string = strftime_now(\"%d %b %Y\") %}\n {%- else %}\n {%- set date_string = \"26 Jul 2024\" %}\n {%- endif %}\n{%- endif %}\n{%- if not tools is defined %}\n {%- set tools = none %}\n{%- endif %}\n\n{#- This block extracts the system message, so we can slot it into the right place. #}\n{%- if messages[0]['role'] == 'system' %}\n {%- set system_message = messages[0]['content']|trim %}\n {%- set messages = messages[1:] %}\n{%- else %}\n {%- set system_message = \"\" %}\n{%- endif %}\n\n{#- System message #}\n{{- \"<|start_header_id|>system<|end_header_id|>\\n\\n\" }}\n{%- if tools is not none %}\n {{- \"Environment: ipython\\n\" }}\n{%- endif %}\n{{- \"Cutting Knowledge Date: December 2023\\n\" }}\n{{- \"Today Date: \" + date_string + \"\\n\\n\" }}\n{%- if tools is not none and not tools_in_user_message %}\n {{- \"You have access to the following functions. To call a function, please respond with JSON for a function call.\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n{%- endif %}\n{{- system_message }}\n{{- \"<|eot_id|>\" }}\n\n{#- Custom tools are passed in a user message with some extra guidance #}\n{%- if tools_in_user_message and not tools is none %}\n {#- Extract the first user message so we can plug it in here #}\n {%- if messages | length != 0 %}\n {%- set first_user_message = messages[0]['content']|trim %}\n {%- set messages = messages[1:] %}\n {%- else %}\n {{- raise_exception(\"Cannot put tools in the first user message when there's no first user message!\") }}\n{%- endif %}\n {{- '<|start_header_id|>user<|end_header_id|>\\n\\n' -}}\n {{- \"Given the following functions, please respond with a JSON for a function call \" }}\n {{- \"with its proper arguments that best answers the given prompt.\\n\\n\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n {{- first_user_message + \"<|eot_id|>\"}}\n{%- endif %}\n\n{%- for message in messages %}\n {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}\n {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\\n\\n'+ message['content'] | trim + '<|eot_id|>' }}\n {%- elif 'tool_calls' in message %}\n {%- if not message.tool_calls|length == 1 %}\n {{- raise_exception(\"This model only supports single tool-calls at once!\") }}\n {%- endif %}\n {%- set tool_call = message.tool_calls[0].function %}\n {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' -}}\n {{- '{\"name\": \"' + tool_call.name + '\", ' }}\n {{- '\"parameters\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- \"}\" }}\n {{- \"<|eot_id|>\" }}\n {%- elif message.role == \"tool\" or message.role == \"ipython\" %}\n {{- \"<|start_header_id|>ipython<|end_header_id|>\\n\\n\" }}\n {%- if message.content is mapping or message.content is iterable %}\n {{- message.content | tojson }}\n {%- else %}\n {{- message.content }}\n {%- endif %}\n {{- \"<|eot_id|>\" }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' }}\n{%- endif %}\n",
2054
  "clean_up_tokenization_spaces": true,
2055
  "eos_token": "<|eot_id|>",
2056
  "extra_special_tokens": {},