File tree Expand file tree Collapse file tree 6 files changed +21
-10
lines changed Expand file tree Collapse file tree 6 files changed +21
-10
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 17
17
- uses : actions/checkout@v4
18
18
with :
19
19
fetch-depth : 0
20
+ lfs : false
20
21
21
22
- name : Install pnpm
22
23
uses : pnpm/action-setup@v4
Original file line number Diff line number Diff line change 24
24
- uses : actions/checkout@v4
25
25
with :
26
26
fetch-depth : 0
27
- lfs : true
27
+ lfs : false
28
+
29
+ - name : Download ONNX model from release
30
+ run : |
31
+ mkdir -p packages/api/services/story-search/model
32
+ curl -L -o packages/api/services/story-search/model/comic_embedding_model.onnx \
33
+ https://github.com/ducksmanager/core/releases/download/v1.0.0-model/comic_embedding_model.onnx
28
34
29
35
- name : Log in to the Container registry
30
36
uses : docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ RUN npm install -g pm2
11
11
12
12
COPY ./node_modules/.pnpm/onnxruntime-node@*/node_modules/onnxruntime-node/bin/napi-v6/linux/x64 /bin/napi-v6/linux/x64
13
13
14
- COPY ./packages/api/services/story-search/model/comic_embedding_model.onnx /app/services/story-search/model/comic_embedding_model.onnx
14
+ # ONNX model will be downloaded during CI/CD from GitHub release
15
+ # COPY ./packages/api/services/story-search/model/comic_embedding_model.onnx /app/services/story-search/model/comic_embedding_model.onnx
15
16
16
17
RUN npm install --os=linux --cpu=x64 sharp
17
18
Original file line number Diff line number Diff line change @@ -12,10 +12,17 @@ let session: InferenceSession | undefined = undefined;
12
12
export const getSession = async ( ) => {
13
13
if ( ! session ) {
14
14
console . log ( "Loading model..." ) ;
15
- session = await InferenceSession . create (
16
- "./services/story-search/model/comic_embedding_model.onnx" ,
17
- ) ;
18
- console . log ( "Model loaded" ) ;
15
+ try {
16
+ session = await InferenceSession . create (
17
+ "./services/story-search/model/comic_embedding_model.onnx" ,
18
+ ) ;
19
+ console . log ( "Model loaded" ) ;
20
+ } catch ( error ) {
21
+ console . error ( "Failed to load ONNX model:" , error ) ;
22
+ throw new Error (
23
+ "ONNX model not found. Please ensure the model file is downloaded from GitHub release v1.0.0-model"
24
+ ) ;
25
+ }
19
26
}
20
27
return session ;
21
28
} ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments