Spaces:
Running
Running
Update index.html
Browse files- index.html +174 -19
index.html
CHANGED
@@ -1,19 +1,174 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>LLaMA-Pro Dry Run</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
font-family: sans-serif;
|
10 |
+
display: flex;
|
11 |
+
justify-content: center;
|
12 |
+
align-items: center;
|
13 |
+
min-height: 100vh;
|
14 |
+
background-color: #f4f4f4;
|
15 |
+
margin: 0;
|
16 |
+
}
|
17 |
+
.container {
|
18 |
+
background: white;
|
19 |
+
padding: 20px;
|
20 |
+
border-radius: 8px;
|
21 |
+
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
22 |
+
width: 400px;
|
23 |
+
}
|
24 |
+
.input-group {
|
25 |
+
margin-bottom: 10px;
|
26 |
+
}
|
27 |
+
.input-group label {
|
28 |
+
display: block;
|
29 |
+
margin-bottom: 5px;
|
30 |
+
}
|
31 |
+
.input-group input {
|
32 |
+
width: 100%;
|
33 |
+
padding: 8px;
|
34 |
+
border: 1px solid #ddd;
|
35 |
+
border-radius: 4px;
|
36 |
+
box-sizing: border-box;
|
37 |
+
}
|
38 |
+
button {
|
39 |
+
background-color: #007bff;
|
40 |
+
color: white;
|
41 |
+
border: none;
|
42 |
+
padding: 10px 15px;
|
43 |
+
border-radius: 4px;
|
44 |
+
cursor: pointer;
|
45 |
+
margin-bottom: 15px;
|
46 |
+
}
|
47 |
+
button:hover {
|
48 |
+
background-color: #0056b3;
|
49 |
+
}
|
50 |
+
.output {
|
51 |
+
margin-bottom: 20px;
|
52 |
+
}
|
53 |
+
pre {
|
54 |
+
background-color: #f9f9f9;
|
55 |
+
padding: 10px;
|
56 |
+
border: 1px solid #eee;
|
57 |
+
white-space: pre-wrap;
|
58 |
+
}
|
59 |
+
</style>
|
60 |
+
</head>
|
61 |
+
<body>
|
62 |
+
<div class="container">
|
63 |
+
<h1>Model Expansion with LLaMA-Pro</h1>
|
64 |
+
<div class="input-group">
|
65 |
+
<label for="originalLayers">Original Layers:</label>
|
66 |
+
<input type="number" id="originalLayers" value="32">
|
67 |
+
</div>
|
68 |
+
<div class="input-group">
|
69 |
+
<label for="targetLayers">Target Layers:</label>
|
70 |
+
<input type="number" id="targetLayers" value="40">
|
71 |
+
</div>
|
72 |
+
<button id="calculateButton">Calculate Duplicated Layers</button>
|
73 |
+
<div class="output">
|
74 |
+
<h2>Output Array:</h2>
|
75 |
+
<pre id="outputArray"></pre>
|
76 |
+
</div>
|
77 |
+
<div class="logs">
|
78 |
+
<h2>Logs:</h2>
|
79 |
+
<pre id="logs"></pre>
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
<script>
|
83 |
+
document.getElementById('calculateButton').addEventListener('click', function() {
|
84 |
+
const originalLayers = parseInt(document.getElementById('originalLayers').value);
|
85 |
+
const targetLayers = parseInt(document.getElementById('targetLayers').value);
|
86 |
+
const outputArrayElement = document.getElementById('outputArray');
|
87 |
+
const logsElement = document.getElementById('logs');
|
88 |
+
logsElement.textContent = ""; // Clear previous logs
|
89 |
+
|
90 |
+
function logMessage(message) {
|
91 |
+
logsElement.textContent += message + "\n";
|
92 |
+
}
|
93 |
+
|
94 |
+
function validateInputs(originalLayers, targetLayers){
|
95 |
+
if (isNaN(originalLayers) || isNaN(targetLayers)) {
|
96 |
+
logMessage("Error: Layer counts must be numeric values.");
|
97 |
+
return false;
|
98 |
+
}
|
99 |
+
|
100 |
+
if(originalLayers <= 0){
|
101 |
+
logMessage("Error: Original layers must be positive.");
|
102 |
+
return false;
|
103 |
+
}
|
104 |
+
|
105 |
+
if (targetLayers <= 0) {
|
106 |
+
logMessage("Error: Target layers must be positive.");
|
107 |
+
return false;
|
108 |
+
}
|
109 |
+
|
110 |
+
if (targetLayers <= originalLayers) {
|
111 |
+
logMessage("Error: Target layers must be greater than original layers.");
|
112 |
+
return false;
|
113 |
+
}
|
114 |
+
|
115 |
+
if (!Number.isInteger(originalLayers) || !Number.isInteger(targetLayers)) {
|
116 |
+
logMessage("Error: Layer counts must be integers.");
|
117 |
+
return false;
|
118 |
+
}
|
119 |
+
|
120 |
+
return true
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
if (!validateInputs(originalLayers, targetLayers)){
|
125 |
+
outputArrayElement.textContent = "[]";
|
126 |
+
return
|
127 |
+
}
|
128 |
+
|
129 |
+
logMessage("Starting dry run calculation...");
|
130 |
+
let duplicatedLayers = [];
|
131 |
+
let layerCount = 0;
|
132 |
+
|
133 |
+
const additionalLayers = targetLayers - originalLayers;
|
134 |
+
|
135 |
+
if (additionalLayers <= 0){
|
136 |
+
logMessage("Error: Invalid layer configuration");
|
137 |
+
outputArrayElement.textContent = "[]";
|
138 |
+
return
|
139 |
+
}
|
140 |
+
|
141 |
+
const split = Math.floor(originalLayers / additionalLayers);
|
142 |
+
|
143 |
+
if (split === 0){
|
144 |
+
logMessage("Error: Split factor calculation resulted in zero");
|
145 |
+
outputArrayElement.textContent = "[]";
|
146 |
+
return
|
147 |
+
}
|
148 |
+
|
149 |
+
logMessage("Split factor calculated: " + split);
|
150 |
+
|
151 |
+
for (let i = 0; i < originalLayers; i++){
|
152 |
+
logMessage("Processing layer " + (i + 1) + "/" + originalLayers);
|
153 |
+
duplicatedLayers.push(i);
|
154 |
+
layerCount++;
|
155 |
+
|
156 |
+
if ((i + 1) % split === 0 && layerCount < targetLayers) {
|
157 |
+
logMessage("Duplicating layer " + (i+1));
|
158 |
+
duplicatedLayers.push(i);
|
159 |
+
layerCount++;
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
if(layerCount != targetLayers){
|
164 |
+
logMessage("Error: Layer count mismatch. Expected " + targetLayers + ", got " + layerCount);
|
165 |
+
outputArrayElement.textContent = "[]";
|
166 |
+
return
|
167 |
+
}
|
168 |
+
|
169 |
+
logMessage("Dry run completed successfully");
|
170 |
+
outputArrayElement.textContent = JSON.stringify(duplicatedLayers, null, 2);
|
171 |
+
});
|
172 |
+
</script>
|
173 |
+
</body>
|
174 |
+
</html>
|