Skip to content

Commit

Permalink
Do not download model again
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy committed Jan 22, 2024
1 parent 4696e3f commit 4bec89b
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions packages/backend/src/managers/applicationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,29 @@ export class ApplicationManager {
container => container.arch === undefined || container.arch === arch(),
);

// Download model
taskUtil.setTask({
id: model.id,
state: 'loading',
name: `Downloading model ${model.name}`,
labels: {
'model-pulling': model.id,
},
});
const localModels = this.getLocalModels();
if (!localModels.map(m => m.id).includes(model.id)) {
// Download model
taskUtil.setTask({
id: model.id,
state: 'loading',
name: `Downloading model ${model.name}`,
labels: {
'model-pulling': model.id,
},
});

await this.downloadModelMain(model.id, model.url, taskUtil);
await this.downloadModelMain(model.id, model.url, taskUtil);
} else {
taskUtil.setTask({
id: model.id,
state: 'success',
name: `Model ${model.name} already present on disk`,
labels: {
'model-pulling': model.id,
},
});
}

filteredContainers.forEach(container => {
taskUtil.setTask({
Expand Down

0 comments on commit 4bec89b

Please sign in to comment.