Spaces:
Sleeping
Sleeping
Commit
·
1c54318
1
Parent(s):
033f68d
fixed out of bounds for layer
Browse files
frontend/src/components/Options.jsx
CHANGED
|
@@ -43,10 +43,19 @@ const Options = ({
|
|
| 43 |
setMergeStatus("Merging models...");
|
| 44 |
|
| 45 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
const mergeData = {
|
| 47 |
model1_name: selectedModel1,
|
| 48 |
model2_name: selectedModel2,
|
| 49 |
-
layer_recipe:
|
| 50 |
embedding_lambdas: embeddingLambdas,
|
| 51 |
linear_lambdas: linearLambdas,
|
| 52 |
merged_name: mergedName,
|
|
|
|
| 43 |
setMergeStatus("Merging models...");
|
| 44 |
|
| 45 |
try {
|
| 46 |
+
// Convert layer indices from 1-based (frontend) to 0-based (backend)
|
| 47 |
+
const backendLayerRecipe = layerRecipe.map((layer) =>
|
| 48 |
+
layer.map((block) => [
|
| 49 |
+
block[0] - 1, // Convert sourceLayer from 1-based to 0-based
|
| 50 |
+
block[1], // modelIndex stays the same
|
| 51 |
+
block[2], // percentage stays the same
|
| 52 |
+
])
|
| 53 |
+
);
|
| 54 |
+
|
| 55 |
const mergeData = {
|
| 56 |
model1_name: selectedModel1,
|
| 57 |
model2_name: selectedModel2,
|
| 58 |
+
layer_recipe: backendLayerRecipe,
|
| 59 |
embedding_lambdas: embeddingLambdas,
|
| 60 |
linear_lambdas: linearLambdas,
|
| 61 |
merged_name: mergedName,
|
frontend/src/components/Recipe.jsx
CHANGED
|
@@ -71,6 +71,7 @@ const Recipe = ({
|
|
| 71 |
|
| 72 |
const addBlockToLayer = (layerIndex) => {
|
| 73 |
const newRecipe = [...layerRecipe];
|
|
|
|
| 74 |
const newBlock = [1, Math.random() < 0.5 ? 0 : 1, 0.5];
|
| 75 |
newRecipe[layerIndex] = [...newRecipe[layerIndex], newBlock];
|
| 76 |
setLayerRecipe(newRecipe);
|
|
|
|
| 71 |
|
| 72 |
const addBlockToLayer = (layerIndex) => {
|
| 73 |
const newRecipe = [...layerRecipe];
|
| 74 |
+
// layer 1, model 0 or 1, weight 0.5
|
| 75 |
const newBlock = [1, Math.random() < 0.5 ? 0 : 1, 0.5];
|
| 76 |
newRecipe[layerIndex] = [...newRecipe[layerIndex], newBlock];
|
| 77 |
setLayerRecipe(newRecipe);
|