djuna commited on
Commit
26d6e68
1 Parent(s): fd2cea4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +173 -19
index.html CHANGED
@@ -1,19 +1,173 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>YAML Config Generator</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 0;
11
+ padding: 20px;
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ min-height: 100vh;
16
+ }
17
+ .container {
18
+ background-color: #f9f9f9;
19
+ padding: 20px;
20
+ border-radius: 8px;
21
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
22
+ width: 100%;
23
+ max-width: 400px;
24
+ }
25
+ h1 {
26
+ text-align: center;
27
+ color: #333;
28
+ }
29
+ form {
30
+ display: flex;
31
+ flex-direction: column;
32
+ gap: 15px;
33
+ }
34
+ label {
35
+ font-weight: bold;
36
+ margin-bottom: 5px;
37
+ display: block;
38
+ }
39
+ input {
40
+ width: 100%;
41
+ padding: 8px;
42
+ border: 1px solid #ccc;
43
+ border-radius: 4px;
44
+ box-sizing: border-box;
45
+ }
46
+ button {
47
+ background-color: #3b82f6;
48
+ color: white;
49
+ border: none;
50
+ padding: 10px;
51
+ border-radius: 4px;
52
+ cursor: pointer;
53
+ font-weight: bold;
54
+ }
55
+ button:hover {
56
+ background-color: #2563eb;
57
+ }
58
+ #error {
59
+ color: #dc2626;
60
+ margin-top: 10px;
61
+ }
62
+ #result {
63
+ margin-top: 20px;
64
+ }
65
+ pre {
66
+ background-color: #f3f4f6;
67
+ padding: 10px;
68
+ border-radius: 4px;
69
+ overflow-x: auto;
70
+ white-space: pre-wrap;
71
+ word-wrap: break-word;
72
+ }
73
+ </style>
74
+ </head>
75
+ <body>
76
+ <div class="container">
77
+ <h1>YAML Config Generator</h1>
78
+ <form id="configForm">
79
+ <div>
80
+ <label for="rangeSize">Range Size:</label>
81
+ <input type="number" id="rangeSize" name="rangeSize" required placeholder="Range size (e.g. 42)">
82
+ </div>
83
+ <div>
84
+ <label for="totalLayers">Total Layers:</label>
85
+ <input type="number" id="totalLayers" name="totalLayers" required placeholder="Total number of layers (e.g. 126)">
86
+ </div>
87
+ <div>
88
+ <label for="nbParameters">Number of Parameters (B):</label>
89
+ <input type="number" id="nbParameters" name="nbParameters" step="0.01" required placeholder="Number of parameters in the model (e.g. 410.0)">
90
+ </div>
91
+ <div>
92
+ <label for="model">Model:</label>
93
+ <input type="text" id="model" name="model" required placeholder="Model name (e.g. meta-llama/Meta-Llama-3.1-405B-Instruct)">
94
+ </div>
95
+ <button type="submit">Generate Config</button>
96
+ </form>
97
+ <div id="error" style="display: none;"></div>
98
+ <div id="result" style="display: none;">
99
+ <h2>Results:</h2>
100
+ <p id="newSize"></p>
101
+ <p id="newParam"></p>
102
+ <h3>YAML Config:</h3>
103
+ <pre id="yamlOutput"></pre>
104
+ </div>
105
+ </div>
106
+
107
+ <script>
108
+ document.getElementById('configForm').addEventListener('submit', function(e) {
109
+ e.preventDefault();
110
+
111
+ const rangeSize = parseInt(document.getElementById('rangeSize').value);
112
+ const totalLayers = parseInt(document.getElementById('totalLayers').value);
113
+ const nbParameters = parseFloat(document.getElementById('nbParameters').value);
114
+ const model = document.getElementById('model').value;
115
+
116
+ const errorDiv = document.getElementById('error');
117
+ const resultDiv = document.getElementById('result');
118
+ errorDiv.innerHTML = '';
119
+ errorDiv.style.display = 'none';
120
+ resultDiv.style.display = 'none';
121
+
122
+ const errors = [];
123
+
124
+ if (isNaN(rangeSize) || rangeSize <= 0 || !Number.isInteger(rangeSize)) {
125
+ errors.push("Range Size must be a positive integer.");
126
+ }
127
+
128
+ if (isNaN(totalLayers) || totalLayers <= 0 || !Number.isInteger(totalLayers)) {
129
+ errors.push("Total Layers must be a positive integer.");
130
+ }
131
+
132
+ if (isNaN(nbParameters) || nbParameters <= 0) {
133
+ errors.push("Number of Parameters must be a positive number.");
134
+ }
135
+
136
+ if (rangeSize > totalLayers) {
137
+ errors.push("Range Size cannot be greater than Total Layers.");
138
+ }
139
+
140
+ if (model.trim() === "") {
141
+ errors.push("Model name cannot be empty.");
142
+ }
143
+
144
+ if (errors.length > 0) {
145
+ errorDiv.innerHTML = errors.join('<br>');
146
+ errorDiv.style.display = 'block';
147
+ return;
148
+ }
149
+
150
+ let newSize = totalLayers + totalLayers - rangeSize;
151
+ let newParam = (nbParameters / totalLayers) * newSize;
152
+
153
+ let yamlStr = "slices:\n";
154
+
155
+ for (let i = 0; i <= totalLayers - rangeSize; i += rangeSize / 2) {
156
+ let start = i;
157
+ let end = Math.min(start + rangeSize, totalLayers);
158
+ yamlStr += `- sources:\n`;
159
+ yamlStr += ` - layer_range: [${start}, ${end}]\n`;
160
+ yamlStr += ` model: ${model}\n`;
161
+ }
162
+
163
+ yamlStr += "merge_method: passthrough\n";
164
+ yamlStr += "dtype: bfloat16\n";
165
+
166
+ document.getElementById('newSize').textContent = `New size = ${newSize} layers`;
167
+ document.getElementById('newParam').textContent = `New parameters = ${newParam.toFixed(2)}B`;
168
+ document.getElementById('yamlOutput').textContent = yamlStr;
169
+ resultDiv.style.display = 'block';
170
+ });
171
+ </script>
172
+ </body>
173
+ </html>