triggerflow 0.1.9__tar.gz → 0.1.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {triggerflow-0.1.9 → triggerflow-0.1.11}/PKG-INFO +2 -2
- {triggerflow-0.1.9 → triggerflow-0.1.11}/pyproject.toml +2 -2
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow/core.py +6 -14
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow/mlflow_wrapper.py +55 -4
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow.egg-info/PKG-INFO +2 -2
- {triggerflow-0.1.9 → triggerflow-0.1.11}/README.md +0 -0
- {triggerflow-0.1.9 → triggerflow-0.1.11}/setup.cfg +0 -0
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow/__init__.py +0 -0
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow/templates/makefile +0 -0
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow/templates/makefile_version +0 -0
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow/templates/model_template.cpp +0 -0
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow/templates/scales.h +0 -0
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow.egg-info/SOURCES.txt +0 -0
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow.egg-info/dependency_links.txt +0 -0
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow.egg-info/requires.txt +0 -0
- {triggerflow-0.1.9 → triggerflow-0.1.11}/src/triggerflow.egg-info/top_level.txt +0 -0
- {triggerflow-0.1.9 → triggerflow-0.1.11}/tests/test.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: triggerflow
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.11
|
|
4
4
|
Summary: Utilities for ML models targeting hardware triggers
|
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
7
7
|
Classifier: Operating System :: OS Independent
|
|
8
|
-
Requires-Python: >=3.
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
Requires-Dist: mlflow>=2.0
|
|
11
11
|
|
|
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "triggerflow"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.11"
|
|
8
8
|
description = "Utilities for ML models targeting hardware triggers"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
11
|
dependencies = [
|
|
12
12
|
"mlflow>=2.0"
|
|
13
13
|
]
|
|
@@ -111,7 +111,6 @@ class HLS4MLStrategy(CompilerStrategy):
|
|
|
111
111
|
firmware_model.compile()
|
|
112
112
|
return firmware_model
|
|
113
113
|
|
|
114
|
-
|
|
115
114
|
class ConiferStrategy(CompilerStrategy):
|
|
116
115
|
"""Conifer compilation strategy for XGBoost models"""
|
|
117
116
|
|
|
@@ -124,13 +123,11 @@ class ConiferStrategy(CompilerStrategy):
|
|
|
124
123
|
firmware_dir = workspace / "firmware"
|
|
125
124
|
firmware_dir.mkdir(exist_ok=True)
|
|
126
125
|
|
|
126
|
+
|
|
127
|
+
project_name = kwargs.pop('project_name', None)
|
|
128
|
+
|
|
127
129
|
cfg = config or conifer.backends.xilinxhls.auto_config()
|
|
128
130
|
cfg['OutputDir'] = str(firmware_dir)
|
|
129
|
-
|
|
130
|
-
project_name = kwargs.pop('ProjectName', None)
|
|
131
|
-
if project_name:
|
|
132
|
-
cfg['ProjectName'] = project_name
|
|
133
|
-
|
|
134
131
|
cfg.update(kwargs)
|
|
135
132
|
|
|
136
133
|
firmware_model = conifer.converters.convert_from_xgboost(
|
|
@@ -138,6 +135,9 @@ class ConiferStrategy(CompilerStrategy):
|
|
|
138
135
|
config=cfg
|
|
139
136
|
)
|
|
140
137
|
|
|
138
|
+
if project_name:
|
|
139
|
+
firmware_model.config.project_name = project_name
|
|
140
|
+
|
|
141
141
|
firmware_model.compile()
|
|
142
142
|
if shutil.which("vivado") is not None:
|
|
143
143
|
firmware_model.build()
|
|
@@ -146,14 +146,6 @@ class ConiferStrategy(CompilerStrategy):
|
|
|
146
146
|
|
|
147
147
|
firmware_model.save(firmware_dir / "firmware_model.fml")
|
|
148
148
|
return firmware_model
|
|
149
|
-
|
|
150
|
-
def load_compiled_model(self, workspace: Path) -> Any:
|
|
151
|
-
from conifer import load_model
|
|
152
|
-
|
|
153
|
-
firmware_model = load_model(workspace / "firmware_model.fml")
|
|
154
|
-
firmware_model.compile()
|
|
155
|
-
return firmware_model
|
|
156
|
-
|
|
157
149
|
|
|
158
150
|
class DA4MLStrategy(CompilerStrategy):
|
|
159
151
|
"""DA4ML compilation strategy (placeholder)"""
|
|
@@ -10,12 +10,15 @@ from .core import TriggerModel
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def setup_mlflow(mlflow_uri: str = None,
|
|
13
|
+
web_eos_url: str = None,
|
|
14
|
+
web_eos_path: str = None,
|
|
13
15
|
model_name: str = None,
|
|
14
16
|
experiment_name: str = None,
|
|
15
17
|
run_name: str = None,
|
|
16
18
|
experiment_id: str = None,
|
|
17
19
|
run_id: str = None,
|
|
18
|
-
|
|
20
|
+
creat_web_eos_dir: bool = False,
|
|
21
|
+
save_env_file: bool = False,
|
|
19
22
|
auto_configure: bool = False
|
|
20
23
|
):
|
|
21
24
|
|
|
@@ -100,6 +103,34 @@ def setup_mlflow(mlflow_uri: str = None,
|
|
|
100
103
|
os.environ["MLFLOW_RUN_ID"] = run_id
|
|
101
104
|
print(f"Started run with ID: {run_id}")
|
|
102
105
|
|
|
106
|
+
|
|
107
|
+
if creat_web_eos_dir:
|
|
108
|
+
# Set the web_eos_url
|
|
109
|
+
if web_eos_url is None:
|
|
110
|
+
web_eos_url = os.getenv('WEB_EOS_URL', 'https://ngt-modeltraining.web.cern.ch/')
|
|
111
|
+
os.environ["WEB_EOS_URL"] = web_eos_url
|
|
112
|
+
print(f"Using WEB_EOS_URL: {web_eos_url}")
|
|
113
|
+
|
|
114
|
+
# Set the web_eos_path
|
|
115
|
+
if web_eos_path is None:
|
|
116
|
+
web_eos_path = os.getenv('WEB_EOS_PATH', '/eos/user/m/mlflowngt/backend/www')
|
|
117
|
+
os.environ["WEB_EOS_PATH"] = web_eos_path
|
|
118
|
+
print(f"Using WEB_EOS_PATH: {web_eos_path}")
|
|
119
|
+
|
|
120
|
+
# Create WebEOS experiment dir
|
|
121
|
+
web_eos_experiment_dir = os.path.join(web_eos_path, experiment_name, run_name)
|
|
122
|
+
web_eos_experiment_url = os.path.join(web_eos_url, experiment_name, run_name)
|
|
123
|
+
os.makedirs(web_eos_experiment_dir, exist_ok=True)
|
|
124
|
+
print(f"Created WebEOS experiment directory: {web_eos_experiment_dir}")
|
|
125
|
+
print(f"Using WebEOS experiment URL: {web_eos_experiment_url}")
|
|
126
|
+
|
|
127
|
+
else:
|
|
128
|
+
web_eos_url=None
|
|
129
|
+
web_eos_path=None
|
|
130
|
+
web_eos_experiment_dir=None
|
|
131
|
+
web_eos_experiment_url=None
|
|
132
|
+
|
|
133
|
+
|
|
103
134
|
# Save environment variables to a file for later steps in CI/CD pipelines
|
|
104
135
|
if save_env_file and os.getenv("CI") == "true":
|
|
105
136
|
print(f"Saving MLflow environment variables to {os.getenv('CI_ENV_FILE', 'mlflow.env')}")
|
|
@@ -111,11 +142,28 @@ def setup_mlflow(mlflow_uri: str = None,
|
|
|
111
142
|
f.write(f"MLFLOW_EXPERIMENT_ID={experiment_id}\n")
|
|
112
143
|
f.write(f"MLFLOW_RUN_ID={run_id}\n")
|
|
113
144
|
|
|
145
|
+
if creat_web_eos_dir:
|
|
146
|
+
f.write(f"WEB_EOS_URL={web_eos_url}\n")
|
|
147
|
+
f.write(f"WEB_EOS_PATH={web_eos_path}\n")
|
|
148
|
+
f.write(f"WEB_EOS_EXPERIMENT_DIR={web_eos_experiment_dir}\n")
|
|
149
|
+
f.write(f"WEB_EOS_EXPERIMENT_URL={web_eos_experiment_url}\n")
|
|
150
|
+
|
|
114
151
|
if auto_configure:
|
|
115
152
|
print("Auto_configure is set to true. Exporting AUTO_CONFIGURE=true")
|
|
116
153
|
f.write(f"AUTO_CONFIGURE=true\n")
|
|
117
154
|
|
|
118
|
-
return
|
|
155
|
+
return {
|
|
156
|
+
"experiment_name": experiment_name,
|
|
157
|
+
"run_name": run_name,
|
|
158
|
+
"experiment_id": experiment_id,
|
|
159
|
+
"run_id": run_id,
|
|
160
|
+
"mlflow_uri": mlflow_uri,
|
|
161
|
+
"model_name": model_name,
|
|
162
|
+
"web_eos_url": web_eos_url,
|
|
163
|
+
"web_eos_path": web_eos_path,
|
|
164
|
+
"web_eos_experiment_dir": web_eos_experiment_dir,
|
|
165
|
+
"web_eos_experiment_url": web_eos_experiment_url,
|
|
166
|
+
}
|
|
119
167
|
|
|
120
168
|
if os.getenv("AUTO_CONFIGURE") == "true":
|
|
121
169
|
print("AUTO_CONFIGURE is true and running in CI environment. Setting up mlflow...")
|
|
@@ -165,10 +213,13 @@ def _get_pip_requirements(trigger_model: TriggerModel) -> list:
|
|
|
165
213
|
return requirements
|
|
166
214
|
|
|
167
215
|
|
|
168
|
-
def log_model(trigger_model: TriggerModel, registered_model_name: str, artifact_path: str = "TriggerModel"):
|
|
216
|
+
def log_model(trigger_model: TriggerModel, registered_model_name: str = None, artifact_path: str = "TriggerModel"):
|
|
169
217
|
"""Log a TriggerModel as a PyFunc model and register it in the Model Registry."""
|
|
170
218
|
if not registered_model_name:
|
|
171
|
-
|
|
219
|
+
if not os.getenv("MLFLOW_MODEL_NAME"):
|
|
220
|
+
raise ValueError("registered_model_name must be provided and non-empty")
|
|
221
|
+
else:
|
|
222
|
+
registered_model_name = os.getenv("MLFLOW_MODEL_NAME")
|
|
172
223
|
|
|
173
224
|
if mlflow.active_run() is None:
|
|
174
225
|
raise RuntimeError("No active MLflow run. Start a run before logging.")
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: triggerflow
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.11
|
|
4
4
|
Summary: Utilities for ML models targeting hardware triggers
|
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
7
7
|
Classifier: Operating System :: OS Independent
|
|
8
|
-
Requires-Python: >=3.
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
Requires-Dist: mlflow>=2.0
|
|
11
11
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|