Skip to content

Commit f2641f2

Browse files
authored
Notebook sharing (#66)
* Add jupyterlab-git. * Mount modelplane-flights. * Refactor README for clarity and organization; update quickstart instructions and add Jupyter setup details. * Add note about git management in Jupyter. * Fix typo in README regarding setup of secrets for SUTs
1 parent 7f6127e commit f2641f2

File tree

4 files changed

+127
-32
lines changed

4 files changed

+127
-32
lines changed

README.md

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# ModelPlane
2-
3-
Develop new evaluators / annotators.
1+
# modelplane - an AI evaluator development platform
42

53
## ⚠️ Content warning
64

@@ -12,49 +10,76 @@ These data come with the following warning:
1210
>Consider carefully whether you need to view the prompts and responses, limit exposure to what's necessary, take regular breaks, and stop if you feel uncomfortable.
1311
>For more information on the risks, see [this literature review](https://www.zevohealth.com/wp-content/uploads/2024/07/lit_review_IN-1.pdf) on vicarious trauma.
1412
15-
## Get Started
13+
## Quickstart
1614

17-
You must have docker installed on your system. The
18-
given docker-compose.yaml file will start up:
15+
You must have a docker engine installed on your system. The given
16+
docker-compose.yaml file has definitions for running the following services
17+
locally:
1918

2019
* mlflow tracking server + postgres
2120
* jupyter
2221

23-
1. Clone the repository:
24-
```bash
25-
git clone https://github.com/mlcommons/modelplane.git
26-
cd modelplane
27-
```
28-
1. Environment:
29-
1. Adjust the .env file as needed. The committed .env /
30-
docker-compose.yaml will bring up mlflow, postgres, jupyter, set up
31-
mlflow to use a local disk for artifact storage.
32-
1. Set up secrets for accessing SUTs, as needed in
33-
`modelplane/flightpaths/config/secrets.toml`. See [modelbench](https://github.com/mlcommons/modelbench) for more details.
34-
1. Stage your input data in `modelplane/flightpaths/data`. You can get a
35-
sample input file [here](https://github.com/mlcommons/ailuminate/tree/main).
36-
1. Bring up the services:
37-
```bash
38-
./start_services.sh -d
39-
```
40-
If you are using the cli only, and not using jupyter, you must pass the `no-jupyter` option:
41-
```bash
42-
./start_services.sh -d --no-jupyter
43-
```
44-
1. Visit the [Jupyter Server](http://localhost:8888/?token=changeme). The
22+
First, clone this repo:
23+
```bash
24+
git clone https://github.com/mlcommons/modelplane.git
25+
cd modelplane
26+
```
27+
28+
If you plan to share notebooks, clone
29+
[modelplane-flights](https://github.com/mlcommons/modelplane-flights) as well. Both `modelplane`
30+
and `modelplane-flights` should be in the same directory.
31+
32+
Finally, set up secrets for accessing SUTs, as needed in
33+
`modelplane/flightpaths/config/secrets.toml`. See [modelbench](https://github.com/mlcommons/modelbench) for more details.
34+
35+
36+
### Running jupyter locally against the MLCommons mlflow server.
37+
38+
1. Ensure you have access to the MLCommons mlflow tracking
39+
and artifact server. If not, email
40+
41+
for access.
42+
1. Modify `.env.jupyteronly` to include your credentials for the
43+
MLFlow server (`MLFLOW_TRACKING_USERNAME` /
44+
`MLFLOW_TRACKING_PASSWORD`).
45+
* Alternatively, put the credentials in `~/.mlflow/credentials` as described [here](https://mlflow.org/docs/latest/ml/auth/#credentials-file).
46+
1. To access `modelbench-private` code (assuming you have
47+
access), you must also set `USE_MODELBENCH_PRIVATE=true` in `.env.jupyteronly`. This will forward your ssh agent to the container
48+
allowing it to load the private repository to build the image.
49+
1. Start jupyter with `./start_jupyter.sh`. (You can add the
50+
`-d` flag to start in the background.)
51+
52+
### Running jupyter and mlflow locally.
53+
54+
1. Adjust the `.env` file as needed. The committed `.env` /
55+
`docker-compose.yaml` will bring up mlflow, postgres, jupyter, and set up mlflow to use a local disk for artifact storage.
56+
1. Start services with `./start_services.sh`. (You can add the
57+
`-d` flag to start in the background.)
58+
59+
* If you are using the cli only, and not using jupyter, you must pass the `--no-jupyter` option:
60+
`./start_services.sh -d`
61+
62+
## Getting started in JupyterLab.
63+
64+
1. Visit the [Jupyter Server](http://localhost:8888/lab?token=changeme). The
4565
token is configured in the .env file. You shouldn't need to enter it
4666
more than once (until the server is restarted). You can get started with
4767
the template notebook or create a new one.
48-
1. The runs can be monitored in MLFlow wherever you have that set up. If
49-
local with the default setup, http://localhost:8080.
68+
1. You should see the `flights` directory, which leads to the
69+
`modelplane-flights` repository. Create a user directory
70+
for yourself (`flights/users/{username}`) and either
71+
copy an existing flightpath there or create a notebook from
72+
scratch.
73+
* You can manage branches and commits for
74+
`modelplane-flights` directly from jupyter.
5075

5176
## CLI
5277

5378
You can also interact with modelplane via CLI. Run `poetry run modelplane --help`
5479
for more details.
5580

5681
*Important:* You must set the `MLFLOW_TRACKING_URI` environmental variable.
57-
For example, if you've brought up MLFlow using the docker compose process above,
82+
For example, if you've brought up MLFlow using the fully local docker compose process above,
5883
you could run:
5984
```
6085
MLFLOW_TRACKING_URI=http://localhost:8080 poetry run modelplane get-sut-responses --sut_id {sut_id} --prompts tests/data/prompts.csv --experiment expname

docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ services:
7373
- "8888:8888"
7474
volumes:
7575
- ./flightpaths:/app/flightpaths
76+
# Volume not needed if not using modelplane-flights for sharing notebooks
77+
- ../modelplane-flights:/app/flightpaths/flights
7678
# Volume not needed if using cloud storage for artifacts
7779
- ./mlruns:/mlruns
7880
# Below needed for dvc (via git) support (backed by GCP)

poetry.lock

Lines changed: 68 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jsonlines = "^4"
2222
numpy = "^2"
2323
matplotlib = "^3"
2424
jupyter = "^1"
25+
jupyterlab-git = "*"
2526
scikit-learn = "^1.5.0"
2627
pandas = "^2.2.2"
2728
# plugins (would like to figure out a better way to manage these)

0 commit comments

Comments
 (0)