Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples: create pytorch example using MAITE and HEART #483

Open
wants to merge 32 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0a7a50a
examples: start basic maite example
jtsextonMITRE Feb 22, 2024
913edc8
examples: update pip-compile for requirements regeneration
jtsextonMITRE Feb 22, 2024
7eafc97
examples: update torchvision and torch
jtsextonMITRE Feb 22, 2024
8f9e2b3
examples: update gpu requirements
jtsextonMITRE Feb 22, 2024
41e2b3b
examples: fix torch version
jtsextonMITRE Feb 22, 2024
a1b4a57
examples: bump torchaudio version
jtsextonMITRE Feb 22, 2024
27064cd
examples: fix torchaudio version
jtsextonMITRE Feb 22, 2024
de02b78
examples: remove cpu requirement from torch
jtsextonMITRE Feb 23, 2024
7ae7940
examples: change torchaudio version to agree with torch version
jtsextonMITRE Feb 23, 2024
cf4865d
examples: update requirements files and revert pip-compile job
jtsextonMITRE Feb 23, 2024
60a2b01
examples: update docker requirements files
jtsextonMITRE Feb 27, 2024
c0f6e95
Revert "examples: update docker requirements files"
jtsextonMITRE Feb 27, 2024
a5edc79
examples: revert changes to non-pytorch containers
jtsextonMITRE Feb 27, 2024
3cc5db0
examples: add basic maite examples
jtsextonMITRE Mar 11, 2024
089ad8d
examples: update maite example with fgm attack
jtsextonMITRE Mar 20, 2024
217514a
examples: merge some functions in maite example
jtsextonMITRE Mar 21, 2024
23d3420
examples: clear outputs of maite example
jtsextonMITRE Mar 27, 2024
ed8a70e
examples: readded mlflow model name parameter as forward slashes caus…
jtsextonMITRE Mar 27, 2024
33a25cd
examples: revert some requirements files
jtsextonMITRE Mar 28, 2024
136c588
examples: revert some requirements files
jtsextonMITRE Mar 28, 2024
638bb63
examples: updating to maite 0.5.0
jtsextonMITRE Apr 1, 2024
aa6333c
examples: update requirements
jtsextonMITRE Apr 1, 2024
3256b34
examples: remove maite from pyproject
jtsextonMITRE Apr 2, 2024
4949ad2
examples: correct pip-compile
jtsextonMITRE Apr 2, 2024
daaf05b
examples: fix requirements
jtsextonMITRE Apr 2, 2024
3514d1f
examples: downgrade maite
jtsextonMITRE Apr 2, 2024
2aac147
examples: add heart-library
jtsextonMITRE Apr 11, 2024
d8eb83e
examples: update requirements files
jtsextonMITRE Apr 11, 2024
5bfde72
examples: update maite example to use IBM heart for attacks
jtsextonMITRE May 14, 2024
b75d72b
examples: cleaning up maite example
jtsextonMITRE Jun 6, 2024
baf7257
examples: update text for save model
jtsextonMITRE Jun 6, 2024
484e94d
examples: partial refactor of MAITE example - not complete
jtsextonMITRE Jun 18, 2024
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
Prev Previous commit
Next Next commit
examples: readded mlflow model name parameter as forward slashes caus…
…e issues
jtsextonMITRE committed Mar 27, 2024
commit ed8a70e6abc9d7bafc6730744051d27814032267
14 changes: 13 additions & 1 deletion examples/pytorch-maite/demo.ipynb
Original file line number Diff line number Diff line change
@@ -258,12 +258,17 @@
"metadata": {},
"outputs": [],
"source": [
"while mlflow_run_id_is_not_known(response_model):\n",
" time.sleep(1)\n",
" response_model = restapi_client.get_job_by_id(response_model[\"jobId\"])\n",
"\n",
"response_use_model = restapi_client.submit_job(\n",
" workflows_file=WORKFLOWS_TAR_GZ,\n",
" experiment_name=EXPERIMENT_NAME,\n",
" entry_point=\"test_model\",\n",
" entry_point_kwargs=\" \".join([\n",
" \"-P model_version=5\",\n",
" \"-P model_name=loaded_model\",\n",
" \"-P model_version=1\",\n",
" \"-P subset=500\"\n",
" ]),\n",
" queue=\"pytorch_cpu\",\n",
@@ -393,6 +398,13 @@
"source": [
"test_cifar10_fgm(\"huggingface\",\"arize-ai/resnet-50-cifar10-quality-drift\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
2 changes: 2 additions & 0 deletions examples/pytorch-maite/src/save_model.yml
Original file line number Diff line number Diff line change
@@ -70,6 +70,7 @@ tasks:
- provider_name: string
- model_name: string
- task: string
- register_model_name: string
outputs:
model: model
graph:
@@ -78,3 +79,4 @@ graph:
provider_name: $model_provider_name
model_name: $model_name
task: $model_task
register_model_name: $register_model
4 changes: 2 additions & 2 deletions examples/task-plugins/dioptra_custom/maite/maite.py
Original file line number Diff line number Diff line change
@@ -61,13 +61,13 @@ def transform_tensor(dataset: Any, shape: Tuple[int, int], totensor=False, subse
dataset = [dataset[i] for i in random.sample(range(0, len(dataset)), subset)]
return dataset
@pyplugs.register
def get_model(provider_name: str, model_name: str, task: str) -> Any:
def get_model(provider_name: str, model_name: str, task: str, register_model_name: str = 'loaded_model') -> Any:
model = load_model(
provider=provider_name,
model_name=model_name,
task=task
)
_register_init_model(model_name,'model',model)
_register_init_model(register_model_name,'model',model)
return model
@pyplugs.register
def get_metric(provider_name: str, metric_name: str, task: str, classes: int) -> Any: