forked from Blizaine/Maestro
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsam_install.js
More file actions
72 lines (71 loc) · 2.18 KB
/
Copy pathsam_install.js
File metadata and controls
72 lines (71 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// SAM 3.1 Segmentation Service — Install Script
// Creates a separate Python 3.12 conda env and installs SAM 3.1 + dependencies.
// Called by the Pinokio menu and update.js.
const vendors = require("./vendor_revisions")
const sam3 = vendors.sam3
module.exports = {
run: [
// Step 1: Clone SAM 3 repo if not already present
{
when: "{{!exists('" + sam3.path + "')}}",
method: "shell.run",
params: {
message: [
"git clone --depth 1 " + sam3.url + " " + sam3.path,
"git -C " + sam3.path + " fetch --depth 1 origin " + sam3.revision,
"git -C " + sam3.path + " checkout --detach " + sam3.revision
]
}
},
// Step 1b: Re-select the declared revision if repo already exists.
{
when: "{{exists('" + sam3.path + "/.git')}}",
method: "shell.run",
params: {
path: sam3.path,
message: [
"git fetch --depth 1 origin " + sam3.revision,
"git checkout --detach " + sam3.revision
]
}
},
// Step 2: Install PyTorch (CUDA 12.8) in a Python 3.12 conda env
{
method: "shell.run",
params: {
conda: {
path: "app/services/sam/env",
python: "3.12"
},
message: [
"pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128"
]
}
},
// Step 3: Install SAM 3 package + all microservice deps from requirements.txt
{
method: "shell.run",
params: {
conda: {
path: "app/services/sam/env",
python: "3.12"
},
message: [
"pip install app/services/sam/sam3",
"pip install -r app/services/sam/requirements.txt"
]
}
},
{
method: "fs.write",
params: {
path: sam3.marker,
text: "repository=" + sam3.url + "\nrevision=" + sam3.revision + "\n"
}
},
// Note: SAM 3.1 model checkpoints (~1.7GB each for base + multiplex) are downloaded
// automatically on first use. The service tries the official facebook/sam3 repo first,
// and falls back to ungated mirrors (jetjodh/sam3, jetjodh/sam3.1) if gated access
// is not available.
]
}