Skip to content

Commit 9a4b58d

Browse files
Updated setup, improved UI.
Updated requirements.txt to include svd package. Updated tests.yml and Dockerfile to install torch in appropriate ways. Improved the UI by making the pages more consistent with each other and removing the scrollbar where it was not needed.
1 parent 76429a5 commit 9a4b58d

11 files changed

Lines changed: 184 additions & 90 deletions

File tree

.github/workflows/tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ jobs:
3030
use-mamba: true
3131
auto-activate-base: false
3232

33-
- name: Install additional pip dependencies
34-
run: conda run -n hotel_management pip install -r requirements.txt coverage
33+
- name: Install additional pip dependencies (CPU-safe version of torch)
34+
run: |
35+
conda run -n hotel_management pip install torch==2.10.0
36+
conda run -n hotel_management pip install -r requirements.txt
37+
conda run -n hotel_management pip install coverage
3538
3639
- name: Show environment
3740
run: conda run -n hotel_management conda list

Dockerfile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# ===== Base image with GPU support =====
2-
FROM pytorch/pytorch:2.10.0-cuda12.8-cudnn9-runtime
2+
# FROM pytorch/pytorch:2.10.0-cuda12.8-cudnn9-runtime
3+
FROM nvidia/cuda:12.8.0-runtime-ubuntu22.04
34

45
# ===== Set working directory =====
56
WORKDIR /app
@@ -29,9 +30,20 @@ COPY setup.py .
2930
COPY pyproject.toml .
3031

3132
# ===== Create Conda environment =====
32-
RUN conda env create -f /tmp/environment.yml -n hotel_management && \
33-
conda run -n hotel_management pip install -r /tmp/requirements.txt && \
34-
conda run -n hotel_management pip install -e .
33+
# Create env
34+
RUN conda env create -f /tmp/environment.yml -n hotel_management
35+
36+
# Install torch (nightly CUDA 12.8)
37+
# This version works with Nvidia RTX 5070 Ti GPU. If you experience issues, change to a compatible version for your GPU.
38+
RUN conda run -n hotel_management pip install --pre \
39+
torch==2.12.0.dev20260320+cu128 \
40+
--index-url https://download.pytorch.org/whl/nightly/cu128
41+
42+
# Install rest
43+
RUN conda run -n hotel_management pip install -r /tmp/requirements.txt
44+
45+
# Install your package
46+
RUN conda run -n hotel_management pip install -e .
3547

3648
# ===== Use the environment for all container commands =====
3749
SHELL ["conda", "run", "-n", "hotel_management", "/bin/bash", "-c"]
@@ -44,15 +56,10 @@ COPY ml_service ./ml_service
4456

4557
# ===== Expose ports =====
4658
EXPOSE 8000
47-
EXPOSE 8050-8055
59+
EXPOSE 8050
4860

4961
# ===== Run all services =====
5062
CMD bash -c "\
5163
uvicorn ml_service.backend.main:app --reload --host 0.0.0.0 --port 8000 & \
52-
python -m ml_service.frontend.pipelines.app --host 0.0.0.0 --port 8050 & \
53-
python -m ml_service.frontend.configs.modeling.app --host 0.0.0.0 --port 8051 & \
54-
python -m ml_service.frontend.configs.data.app --host 0.0.0.0 --port 8052 & \
55-
python -m ml_service.frontend.configs.features.app --host 0.0.0.0 --port 8053 & \
56-
python -m ml_service.frontend.configs.pipeline_cfg.app --host 0.0.0.0 --port 8054 & \
57-
python -m ml_service.frontend.configs.promotion_thresholds.app --host 0.0.0.0 --port 8055 & \
64+
python -m ml_service.frontend.app --host 0.0.0.0 --port 8050 & \
5865
wait"

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ services:
2121
- ./orchestration_logs:/app/orchestration_logs
2222
ports:
2323
- "8000:8000"
24-
- "8050-8055:8050-8055"
24+
- "8050:8050"
2525
env_file:
2626
- .env
2727
restart: unless-stopped

ml_service/backend/pipelines/models/pipelines_cli_args.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ class TrainInput(BaseModel):
5656
problem: str
5757
segment: str
5858
version: str
59-
train_run_id: str | None = None
60-
experiment_id: str | None = None
6159
snapshot_binding_key: str | None = None
60+
train_run_id: str | None = None
6261
env: str | None = "default"
6362
strict: bool = True
63+
experiment_id: str | None = None
6464
logging_level: LOGGING_LEVEL = "INFO"
6565
clean_up_failure_management: bool = True
6666
overwrite_existing: bool = False
@@ -70,23 +70,23 @@ class EvaluateInput(BaseModel):
7070
problem: str
7171
segment: str
7272
version: str
73-
experiment_id: str | None = None
74-
train_id: str | None = None
7573
env: str | None = "default"
7674
strict: bool = True
75+
experiment_id: str | None = None
76+
train_id: str | None = None
7777
logging_level: LOGGING_LEVEL = "INFO"
7878

7979
class ExplainInput(BaseModel):
8080
"""Model for the input of the explain pipeline."""
8181
problem: str
8282
segment: str
8383
version: str
84-
experiment_id: str | None = None
85-
train_id: str | None = None
86-
top_k: int | None = None
8784
env: str | None = "default"
8885
strict: bool = True
86+
experiment_id: str | None = None
87+
train_id: str | None = None
8988
logging_level: LOGGING_LEVEL = "INFO"
89+
top_k: int | None = None
9090

9191
class PromoteInput(BaseModel):
9292
"""Model for the input of the promote pipeline."""

ml_service/frontend/app.py

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ def home_layout() -> dbc.Container:
5858
),
5959
html.P(
6060
"Welcome to the ML Service Frontend Dashboard. "
61-
"Use the sidebar to navigate through different pages.",
62-
style={"fontSize": "1.5rem", "marginTop": "4rem"}
61+
"Use the sidebar to navigate through different pages. "
62+
"Read the docs to understand what each element of each config does.",
63+
style={"fontSize": "1.5rem", "marginTop": "4rem", "maxWidth": "50%", "marginLeft": "auto", "marginRight": "auto"}
6364
),
6465
html.Ul(
6566
[
@@ -111,11 +112,21 @@ def home_layout() -> dbc.Container:
111112
])
112113
]),
113114
],
114-
style={"fontSize": "1.2rem", "marginTop": "5rem", "textAlign": "left", "marginLeft": "10%"}
115+
style={
116+
"fontSize": "1.2rem",
117+
"paddingTop": "5rem",
118+
"textAlign": "left",
119+
"marginLeft": "10%"
120+
}
115121
)
116122
],
117123
fluid=True,
118-
style={"minHeight": "100vh", "paddingTop": "50px", "backgroundColor": "#8fa0d8", "textAlign": "center"}
124+
style={
125+
"minHeight": "100%",
126+
"paddingTop": "50px",
127+
"backgroundColor": "#8fa0d8",
128+
"textAlign": "center"
129+
}
119130
)
120131

121132
# Sidebar links (excluding Home)
@@ -146,7 +157,14 @@ def generate_page_links():
146157
dbc.Col(
147158
[
148159
# Separate Home button
149-
dbc.Button("Home", href="/", color="secondary", className="mb-3", style={"width": "100%"}),
160+
dbc.Button(
161+
"Home",
162+
id="home-button",
163+
href="/",
164+
color="secondary",
165+
className="mb-3",
166+
style={"width": "100%"}
167+
),
150168

151169
# Sidebar toggle button (hamburger icon)
152170
dbc.Button("☰", id="sidebar-toggle", color="primary", className="mb-3", n_clicks=0, style={"width": "100%"}),
@@ -163,24 +181,36 @@ def generate_page_links():
163181
),
164182
],
165183
width=2,
166-
style={"position": "sticky", "marginTop": "5rem", "padding": "10px"}
184+
style={"position": "sticky", "marginTop": "5rem"}
167185
),
168186
dbc.Col(
169-
html.Div(id="page-content-container", style={"padding": "20px"}),
187+
html.Div(id="page-content-container", style={
188+
"padding": "20px",
189+
"height": "98vh",
190+
"overflowY": "auto",
191+
}),
170192
width=10,
171193
)
172194
],
173-
style={"minHeight": "100vh", "backgroundColor": "#c1cbda"}
174-
)
195+
style={
196+
"minHeight": "100vh",
197+
"backgroundColor": "#c1cbda",
198+
"overflow": "hidden"
199+
}
200+
),
175201
],
176-
fluid=True
202+
fluid=True,
203+
style={
204+
"overflow": "hidden",
205+
}
177206
)
178207

179208
# Callback to toggle sidebar collapse
180209
@app.callback(
181-
Output("sidebar-collapse", "is_open"),
210+
Output("sidebar-collapse", "is_open", allow_duplicate=True),
182211
Input("sidebar-toggle", "n_clicks"),
183-
State("sidebar-collapse", "is_open")
212+
State("sidebar-collapse", "is_open"),
213+
prevent_initial_call=True
184214
)
185215
def toggle_sidebar(n, is_open):
186216
if n:
@@ -212,5 +242,17 @@ def update_active_links(pathname):
212242
current_page = pathname.lstrip("/").replace("_", " ")
213243
return [name == current_page for name in PAGES]
214244

245+
# Callback to close sidebar when Home is clicked
246+
@app.callback(
247+
Output("sidebar-collapse", "is_open", allow_duplicate=True),
248+
Input("home-button", "n_clicks"),
249+
State("sidebar-collapse", "is_open"),
250+
prevent_initial_call=True
251+
)
252+
def close_sidebar_on_home(n_clicks, is_open):
253+
if n_clicks:
254+
return False
255+
return is_open
256+
215257
if __name__ == "__main__":
216258
app.run(debug=True, host="0.0.0.0", port=8050)

ml_service/frontend/configs/features/layout.py

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,54 @@ def build_layout():
1212

1313
return dbc.Container(
1414
[
15-
html.H2(
15+
html.H1(
1616
"Feature Registry Editor",
1717
style={
1818
"textAlign": "center",
19-
"color": "#050525",
20-
"fontWeight": "bold",
21-
"fontSize": "2.5rem",
2219
"marginBottom": "40px",
2320
},
2421
),
25-
dbc.Col(
22+
dbc.Row(
2623
[
27-
dbc.Input(
28-
id=f"{PAGE_PREFIX}-feature-name",
29-
placeholder="Feature set name",
30-
style={
31-
"fontSize": "1.25rem",
32-
"padding": "10px",
33-
"marginRight": "10px",
34-
}
35-
),
36-
dbc.Input(
37-
id=f"{PAGE_PREFIX}-feature-version",
38-
placeholder="Version (e.g. v1)",
39-
style={
40-
"fontSize": "1.25rem",
41-
"padding": "10px",
42-
"marginLeft": "10px",
43-
}
44-
)
24+
dbc.Col([
25+
dbc.Label(
26+
"Feature Set Name",
27+
style={"fontWeight": "bold", "fontSize": "1.25rem"},
28+
html_for=f"{PAGE_PREFIX}-feature-name",
29+
),
30+
dbc.Input(
31+
id=f"{PAGE_PREFIX}-feature-name",
32+
placeholder="e.g. booking_context_features",
33+
type="text",
34+
style={
35+
"fontSize": "1.25rem",
36+
"padding": "10px",
37+
}
38+
),
39+
]),
40+
dbc.Col([
41+
dbc.Label(
42+
"Feature Set Version",
43+
style={"fontWeight": "bold", "fontSize": "1.25rem"},
44+
html_for=f"{PAGE_PREFIX}-feature-version",
45+
),
46+
dbc.Input(
47+
id=f"{PAGE_PREFIX}-feature-version",
48+
placeholder="e.g. v1",
49+
type="text",
50+
style={
51+
"fontSize": "1.25rem",
52+
"padding": "10px",
53+
}
54+
)
55+
], style={"marginBottom": "20px"}),
4556
],
46-
width=4,
4757
style={
58+
"width": "40%",
4859
"margin": "0 auto",
4960
"marginBottom": "20px",
5061
"display": "flex",
51-
"gap": "10px",
62+
"gap": "2rem",
5263
}
5364
),
5465
dash_ace.DashAceEditor(
@@ -98,7 +109,7 @@ def build_layout():
98109
fluid=True,
99110
style={
100111
"backgroundColor": "#8fa0d8",
101-
"minHeight": "100vh",
112+
"minHeight": "100%",
102113
"paddingTop": "45px",
103114
"paddingBottom": "50px",
104115
},

ml_service/frontend/configs/modeling/layout.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ def build_layout():
1717
name,
1818
style={
1919
"textAlign": "center",
20-
"color": "#050525",
21-
"fontWeight": "bold",
22-
"fontSize": "2rem",
20+
"marginBottom": "40px",
2321
}
2422
),
2523
dash_ace.DashAceEditor(
@@ -47,13 +45,10 @@ def build_layout():
4745

4846
layout = dbc.Container(
4947
[
50-
html.H2(
48+
html.H1(
5149
"Modeling Config Editor",
5250
style={
5351
"textAlign": "center",
54-
"color": "#050525",
55-
"fontWeight": "bold",
56-
"fontSize": "2.5rem",
5752
"marginBottom": "40px",
5853
}
5954
),
@@ -88,7 +83,7 @@ def build_layout():
8883
fluid=True,
8984
style={
9085
"backgroundColor": "#8fa0d8",
91-
"minHeight": "100vh",
86+
"minHeight": "100%",
9287
"paddingTop": "45px",
9388
"paddingBottom": "50px",
9489
}

0 commit comments

Comments
 (0)