nexsendev commited on
Commit
02ea75b
·
verified ·
1 Parent(s): 38b1016

Add files using upload-large-folder tool

Browse files
README.md ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - coreml
5
+ - phi-2
6
+ - code-generation
7
+ - html
8
+ - css
9
+ - javascript
10
+ - ios
11
+ - macos
12
+ - apple
13
+ - on-device
14
+ pipeline_tag: text-generation
15
+ base_model: microsoft/phi-2
16
+ ---
17
+
18
+ # 🌐 WebICoder v3 — CoreML
19
+
20
+ **Generate complete, production-ready HTML/CSS websites directly on your iPhone, iPad or Mac — no internet required.**
21
+
22
+ WebICoder v3 is a fine-tuned [Phi-2](https://huggingface.co/microsoft/phi-2) (2.7B parameters) model, optimized for on-device HTML code generation using Apple's CoreML framework.
23
+
24
+ ## 📦 Available Models
25
+
26
+ | Model | Size | Precision | Best For |
27
+ |-------|------|-----------|----------|
28
+ | `WebICoder-v3-fp16.mlpackage` | ~5.5 GB | FP16 | Mac (M1/M2/M3) — maximum quality |
29
+ | `WebICoder-v3-8bit.mlpackage` | ~2.8 GB | INT8 | iPad — good quality, smaller |
30
+ | `WebICoder-v3-4bit.mlpackage` | ~1.4 GB | 4-bit | iPhone — smallest, good quality |
31
+
32
+ ## 🚀 Quick Start (Swift / Xcode)
33
+
34
+ ### 1. Download the model
35
+ ```bash
36
+ # Install Git LFS first
37
+ git lfs install
38
+ git clone https://huggingface.co/nexsendev/webicoder-v3-coreml
39
+ ```
40
+
41
+ ### 2. Add to your Xcode project
42
+ Drag the `.mlpackage` file into your Xcode project. Xcode will automatically compile it.
43
+
44
+ ### 3. Run inference
45
+ ```swift
46
+ import CoreML
47
+ import Tokenizers
48
+
49
+ // Load model
50
+ let config = MLModelConfiguration()
51
+ config.computeUnits = .cpuAndNeuralEngine
52
+ let model = try MLModel(contentsOf: modelURL, configuration: config)
53
+
54
+ // Tokenize input
55
+ let tokenizer = try await AutoTokenizer.from(pretrained: "nexsendev/webicoder-v3-coreml")
56
+ let prompt = "Create a modern landing page for a coffee shop"
57
+ let inputIds = tokenizer.encode(text: prompt)
58
+
59
+ // Run inference
60
+ let inputArray = try MLMultiArray(shape: [1, inputIds.count as NSNumber], dataType: .int32)
61
+ for (i, id) in inputIds.enumerated() {
62
+ inputArray[i] = NSNumber(value: id)
63
+ }
64
+
65
+ let prediction = try model.prediction(from: MLDictionaryFeatureProvider(
66
+ dictionary: ["input_ids": inputArray, "attention_mask": maskArray]
67
+ ))
68
+ ```
69
+
70
+ ## 🐍 Usage with Python (macOS only)
71
+
72
+ ```python
73
+ import coremltools as ct
74
+ import numpy as np
75
+ from transformers import AutoTokenizer
76
+
77
+ # Load
78
+ model = ct.models.MLModel("WebICoder-v3-fp16.mlpackage")
79
+ tokenizer = AutoTokenizer.from_pretrained("nexsendev/webicoder-v3-coreml")
80
+
81
+ # Generate
82
+ prompt = "Create a modern landing page for a coffee shop with dark theme"
83
+ tokens = tokenizer.encode(prompt, return_tensors="np").astype(np.int32)
84
+ mask = np.ones_like(tokens, dtype=np.int32)
85
+
86
+ result = model.predict({"input_ids": tokens, "attention_mask": mask})
87
+ logits = result["logits"]
88
+ ```
89
+
90
+ ## 💬 Prompt Format
91
+
92
+ The model works best with descriptive prompts:
93
+
94
+ ```
95
+ Create a modern landing page for a coffee shop with:
96
+ - Dark theme with warm colors
97
+ - Hero section with a background image
98
+ - Menu section with cards
99
+ - Contact form
100
+ - Responsive design
101
+ ```
102
+
103
+ The model will output a complete, standalone HTML file with embedded CSS.
104
+
105
+ ## ⚙️ Hardware Requirements
106
+
107
+ | Model | Min RAM | Recommended Device |
108
+ |-------|---------|-------------------|
109
+ | FP16 | 6 GB | Mac M1/M2/M3/M4 |
110
+ | 8-bit | 3 GB | iPad Pro, iPad Air |
111
+ | 4-bit | 2 GB | iPhone 15, iPhone 16 |
112
+
113
+ All models require **iOS 17+** or **macOS 14+**.
114
+
115
+ ## 📝 Details
116
+
117
+ - **Base model**: [microsoft/phi-2](https://huggingface.co/microsoft/phi-2) (2.7B parameters)
118
+ - **Fine-tuning**: Trained on curated HTML/CSS website examples
119
+ - **Input**: Natural language description of a website
120
+ - **Output**: Complete HTML with embedded CSS and JavaScript
121
+ - **Context length**: 2048 tokens
122
+ - **License**: MIT
WebICoder-v3-4bit.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1bd5c5538bf4d6f70bfcc2c8bd243b1c1a6a43b62a211de66c5ed34565067eb6
3
+ size 597289
WebICoder-v3-4bit.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:524da859d0a5b47dece290a3a08f9ea604cb305bf4064dd3c48006fd13cd680b
3
+ size 1391344832
WebICoder-v3-4bit.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "01098715-dfec-4c6d-b565-c52a0cc32503": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "1875c66e-a592-4734-9aac-a04cfd998f88": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "01098715-dfec-4c6d-b565-c52a0cc32503"
18
+ }
WebICoder-v3-8bit.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2bcc32fae46feff36a694e1cef95ea04abbac5e90eb2f77971ba858381a2b08a
3
+ size 611009
WebICoder-v3-8bit.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8600f8f9d02c75ee65434bc271c6b2b376532eb72fdea0a77ea0e17fd973c814
3
+ size 2782451072
WebICoder-v3-8bit.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "1001b1cb-25c0-403e-aacc-4f5a0fa7ca26": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "94c920d1-677c-42df-8bda-041608af6a9f": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "1001b1cb-25c0-403e-aacc-4f5a0fa7ca26"
18
+ }
WebICoder-v3-fp16.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:60ea58d4effc3ee7b4d4b03022a55aee49f3e2fca763ec55cf7f99628fc9ba01
3
+ size 566272
WebICoder-v3-fp16.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:556ef76d4b1e92f63ecd39b0751ffb30714db43de378290ca5f59c71d21c9b8b
3
+ size 5559446080
WebICoder-v3-fp16.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "5cfa33f7-33cd-4368-8fde-e67428fd4cd6": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "ae1d3e37-2b43-4c60-bc8d-c759e217419c": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "5cfa33f7-33cd-4368-8fde-e67428fd4cd6"
18
+ }
config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "PhiForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 50256,
7
+ "dtype": "float16",
8
+ "embd_pdrop": 0.0,
9
+ "eos_token_id": 50256,
10
+ "hidden_act": "gelu_new",
11
+ "hidden_size": 2560,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 10240,
14
+ "layer_norm_eps": 1e-05,
15
+ "max_position_embeddings": 2048,
16
+ "model_type": "phi",
17
+ "num_attention_heads": 32,
18
+ "num_hidden_layers": 32,
19
+ "num_key_value_heads": 32,
20
+ "pad_token_id": 50256,
21
+ "partial_rotary_factor": 0.4,
22
+ "qk_layernorm": false,
23
+ "resid_pdrop": 0.1,
24
+ "rope_parameters": {
25
+ "partial_rotary_factor": 0.4,
26
+ "rope_theta": 10000.0,
27
+ "rope_type": "default"
28
+ },
29
+ "tie_word_embeddings": false,
30
+ "transformers_version": "5.0.0",
31
+ "use_cache": true,
32
+ "vocab_size": 51200
33
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 50256,
4
+ "eos_token_id": 50256,
5
+ "transformers_version": "5.0.0"
6
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|endoftext|>",
5
+ "clean_up_tokenization_spaces": true,
6
+ "eos_token": "<|endoftext|>",
7
+ "is_local": false,
8
+ "model_max_length": 2048,
9
+ "tokenizer_class": "TokenizersBackend",
10
+ "unk_token": "<|endoftext|>"
11
+ }