Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions application/backend/src/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

import multiprocessing as mp
import os

import uvicorn
Expand Down Expand Up @@ -63,6 +64,9 @@


if __name__ == "__main__":
if mp.get_start_method(allow_none=True) != "spawn":
mp.set_start_method("spawn", force=True)
Comment on lines +67 to +68
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting the multiprocessing start method globally with force=True can cause issues if other parts of the application or imported libraries have already initialized multiprocessing with a different method. Consider checking if the start method has already been set and handling that case more gracefully, or moving this configuration earlier in the application initialization before any multiprocessing occurs.

Copilot uses AI. Check for mistakes.

settings = get_settings()
uvicorn_port = int(os.environ.get("HTTP_SERVER_PORT", settings.port))
uvicorn.run("main:app", loop="uvloop", host=settings.host, port=uvicorn_port, log_config=None)
2 changes: 2 additions & 0 deletions application/backend/src/services/training_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from anomalib.data.utils import ValSplitMode
from anomalib.deploy import ExportType
from anomalib.engine import Engine
from anomalib.engine.strategy.xpu_single import SingleXPUStrategy
from anomalib.loggers import AnomalibTensorBoardLogger
from anomalib.models import get_model
from loguru import logger
Expand Down Expand Up @@ -214,6 +215,7 @@ def _train_model(
max_epochs=max_epochs,
callbacks=[GetiInspectProgressCallback(synchronization_parameters)],
accelerator=training_device,
**({"strategy": SingleXPUStrategy()} if training_device == "xpu" else {}),
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using dictionary unpacking with a conditional expression makes this line harder to read. Consider extracting this logic into a separate variable or using a more explicit conditional structure for better clarity.

Copilot uses AI. Check for mistakes.
)

# Execute training and export
Expand Down
Loading