Skip to content

Commit f6ec144

Browse files
committed
Make shallow copy of model_inputs before in-place changes
1 parent 1dd682b commit f6ec144

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/models.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6012,6 +6012,8 @@ export class SamModel extends SamPreTrainedModel {
60126012
...model_inputs,
60136013
...(await this.get_image_embeddings(model_inputs))
60146014
}
6015+
} else {
6016+
model_inputs = { ...model_inputs };
60156017
}
60166018

60176019
// Set default input labels if they are missing
@@ -6117,6 +6119,8 @@ export class EdgeTamModel extends EdgeTamPreTrainedModel {
61176119
...model_inputs,
61186120
...(await this.get_image_embeddings(model_inputs))
61196121
}
6122+
} else {
6123+
model_inputs = { ...model_inputs };
61206124
}
61216125

61226126
if (model_inputs.input_points) {

0 commit comments

Comments
 (0)