Spaces:
Sleeping
Sleeping
update requirements1
Browse files
physics_mcp/mcp_output/mcp_plugin/mcp_service.py
CHANGED
|
@@ -5,9 +5,6 @@ source_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.pa
|
|
| 5 |
sys.path.insert(0, source_path)
|
| 6 |
|
| 7 |
from fastmcp import FastMCP
|
| 8 |
-
from physicsnemo.active_learning.driver import Driver
|
| 9 |
-
from physicsnemo.launch.logging.launch import LaunchLogger
|
| 10 |
-
from physicsnemo.deploy.triton import deploy_model
|
| 11 |
|
| 12 |
mcp = FastMCP("physicsnemo_service")
|
| 13 |
|
|
@@ -27,6 +24,8 @@ def run_active_learning_tool(config: dict, learner: object, strategies_config: d
|
|
| 27 |
dict: A dictionary containing success, result, or error fields.
|
| 28 |
"""
|
| 29 |
try:
|
|
|
|
|
|
|
| 30 |
driver = Driver(config, learner, strategies_config, training_config, inference_fn)
|
| 31 |
result = driver.run()
|
| 32 |
return {"success": True, "result": result, "error": None}
|
|
@@ -51,6 +50,8 @@ def log_minibatch_tool(name_space: str, losses: dict, epoch: int = 1, num_mini_b
|
|
| 51 |
dict: A dictionary containing success, result, or error fields.
|
| 52 |
"""
|
| 53 |
try:
|
|
|
|
|
|
|
| 54 |
logger = LaunchLogger(name_space, epoch, num_mini_batch, profile, mini_batch_log_freq, epoch_alert_freq)
|
| 55 |
logger.log_minibatch(losses)
|
| 56 |
return {"success": True, "result": "Mini-batch logged successfully.", "error": None}
|
|
@@ -70,6 +71,8 @@ def deploy_model_tool(model_path: str, config_path: str) -> dict:
|
|
| 70 |
dict: A dictionary containing success, result, or error fields.
|
| 71 |
"""
|
| 72 |
try:
|
|
|
|
|
|
|
| 73 |
result = deploy_model(model_path, config_path)
|
| 74 |
return {"success": True, "result": result, "error": None}
|
| 75 |
except Exception as e:
|
|
|
|
| 5 |
sys.path.insert(0, source_path)
|
| 6 |
|
| 7 |
from fastmcp import FastMCP
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
mcp = FastMCP("physicsnemo_service")
|
| 10 |
|
|
|
|
| 24 |
dict: A dictionary containing success, result, or error fields.
|
| 25 |
"""
|
| 26 |
try:
|
| 27 |
+
# Lazy import to avoid heavy dependencies at startup
|
| 28 |
+
from physicsnemo.active_learning.driver import Driver
|
| 29 |
driver = Driver(config, learner, strategies_config, training_config, inference_fn)
|
| 30 |
result = driver.run()
|
| 31 |
return {"success": True, "result": result, "error": None}
|
|
|
|
| 50 |
dict: A dictionary containing success, result, or error fields.
|
| 51 |
"""
|
| 52 |
try:
|
| 53 |
+
# Lazy import to avoid heavy dependencies at startup
|
| 54 |
+
from physicsnemo.launch.logging.launch import LaunchLogger
|
| 55 |
logger = LaunchLogger(name_space, epoch, num_mini_batch, profile, mini_batch_log_freq, epoch_alert_freq)
|
| 56 |
logger.log_minibatch(losses)
|
| 57 |
return {"success": True, "result": "Mini-batch logged successfully.", "error": None}
|
|
|
|
| 71 |
dict: A dictionary containing success, result, or error fields.
|
| 72 |
"""
|
| 73 |
try:
|
| 74 |
+
# Lazy import to avoid heavy dependencies at startup
|
| 75 |
+
from physicsnemo.deploy.triton import deploy_model
|
| 76 |
result = deploy_model(model_path, config_path)
|
| 77 |
return {"success": True, "result": result, "error": None}
|
| 78 |
except Exception as e:
|
physics_mcp/mcp_output/requirements.txt
CHANGED
|
@@ -26,13 +26,20 @@ pandas
|
|
| 26 |
pyyaml>=6.0
|
| 27 |
|
| 28 |
# Optional Dependencies (can be uncommented as needed)
|
| 29 |
-
#
|
|
|
|
|
|
|
| 30 |
# wandb>=0.13.7
|
| 31 |
# mlflow>=2.1.1
|
| 32 |
-
#
|
| 33 |
-
#
|
|
|
|
|
|
|
|
|
|
| 34 |
# torch-harmonics>=0.6.5
|
| 35 |
# tensorly>=0.8.1
|
|
|
|
|
|
|
| 36 |
# vtk>=9.2.6
|
| 37 |
# netCDF4>=1.6.3
|
| 38 |
# h5py>=3.7.0
|
|
|
|
| 26 |
pyyaml>=6.0
|
| 27 |
|
| 28 |
# Optional Dependencies (can be uncommented as needed)
|
| 29 |
+
# Launch dependencies (required only by log_minibatch and run_active_learning tools)
|
| 30 |
+
# hydra-core>=1.2.0
|
| 31 |
+
# termcolor>=2.1.1
|
| 32 |
# wandb>=0.13.7
|
| 33 |
# mlflow>=2.1.1
|
| 34 |
+
# imageio>=2.28.1
|
| 35 |
+
# moviepy>=1.0.3
|
| 36 |
+
|
| 37 |
+
# Other optional dependencies
|
| 38 |
+
# cuml>=24.0.0 (requires RAPIDS conda channel - use scipy fallback instead)
|
| 39 |
# torch-harmonics>=0.6.5
|
| 40 |
# tensorly>=0.8.1
|
| 41 |
+
# dgl
|
| 42 |
+
# pyg
|
| 43 |
# vtk>=9.2.6
|
| 44 |
# netCDF4>=1.6.3
|
| 45 |
# h5py>=3.7.0
|