Skip to content

Commit

Permalink
GitLab Release: TAG=0.4.0, SHA=d4cc7d07, PIPE=20051
Browse files Browse the repository at this point in the history
  • Loading branch information
lockwoodar committed Jul 16, 2024
1 parent 542c6bd commit b875054
Show file tree
Hide file tree
Showing 40 changed files with 6,156 additions and 4,940 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,6 @@ demo/pics/*
# Exceptions for utils/
!utils/**/*.npy
!utils/**/*.pt

# HEART script executions
script_executions/
33 changes: 12 additions & 21 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2023
# Copyright (C) HEART Authors 2024
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
Expand Down Expand Up @@ -30,13 +30,11 @@
logger = logging.getLogger(__name__)

deep_learning_frameworks = [
"keras", "tensorflow1", "tensorflow2", "tensorflow2v1", "pytorch", "kerastf", "mxnet", "jax"
"pytorch",
]
non_deep_learning_frameworks = ["scikitlearn"]

art_supported_frameworks = []
art_supported_frameworks.extend(deep_learning_frameworks)
art_supported_frameworks.extend(non_deep_learning_frameworks)
heart_supported_frameworks = []
heart_supported_frameworks.extend(deep_learning_frameworks)

master_seed(1234)

Expand All @@ -51,25 +49,18 @@ def pytest_addoption(parser):
action="store",
default=get_default_framework(),
help="HEART tests allow you to specify which framework to use. The default framework used is `tensorflow`. "
"Other options available are {0}".format(art_supported_frameworks),
"Other options available are {0}".format(heart_supported_frameworks),
)


@pytest.fixture(scope="session")
def framework(request):
ml_framework = request.config.getoption("--framework")
if ml_framework == "tensorflow":
import tensorflow as tf

if tf.__version__[0] == "2":
ml_framework = "tensorflow2"
else:
ml_framework = "tensorflow1"

if ml_framework not in art_supported_frameworks:
if ml_framework not in heart_supported_frameworks:
raise Exception(
"framework value {0} is unsupported. Please use one of these valid values: {1}".format(
ml_framework, " ".join(art_supported_frameworks)
ml_framework, " ".join(heart_supported_frameworks)
)
)
return ml_framework
Expand All @@ -83,14 +74,14 @@ def framework_agnostic(request, framework):


@pytest.fixture
def art_warning(request):
def _art_warning(exception):
def heart_warning(request):
def _heart_warning(exception):
if type(exception) is HEARTTestFixtureNotImplemented:
if request.node.get_closest_marker("framework_agnostic"):
if not request.node.get_closest_marker("parametrize"):
raise Exception(
"This test has marker framework_agnostic decorator which means it will only be ran "
"once. However the ART test exception was thrown, hence it is never run fully. "
"once. However the HEART test exception was thrown, hence it is never run fully. "
)

# NotImplementedErrors are raised in HEART whenever a test model does not exist for a specific
Expand All @@ -100,7 +91,7 @@ def _art_warning(exception):
else:
raise exception

return _art_warning
return _heart_warning


@pytest.fixture(scope="session")
Expand All @@ -122,7 +113,7 @@ def get_mnist_dataset(load_mnist_dataset, mnist_shape):

@pytest.fixture()
def mnist_shape(framework):
if framework == "pytorch" or framework == "mxnet":
if framework == "pytorch":
return (1, 28, 28)
else:
return (28, 28, 1)
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
project = 'HEART-library'
copyright = '2024, IBM'
author = 'IBM'
release = '0.3.1'
release = '0.4.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
20 changes: 20 additions & 0 deletions docs/source/notebooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,23 @@ HEART Library Notebooks can be found on `github <https://github.com/IBM/heart-li
**Description:** This notebook demonstrates how to perform black-box attacks using HEART and MAITE

**Intended Audience:** All T&E Users

|
``8_get_started_defenses.ipynb``
--------------------------------

**Description:** This notebook demonstrates how to deploy defenses using HEART and MAITE

**Intended Audience:** All T&E Users

|
``9_get_started_maite_evaluate.ipynb``
--------------------------------------

**Description:** This notebook demonstrates how to execute evaluations using HEART and MAITE's ```evaluate``` function

**Intended Audience:** All T&E Users

|
6 changes: 3 additions & 3 deletions docs/source/setup_and_access.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Low-code front-end application available at `HEART Gradio Application <https://h
Setup for high code users
-------------------------

Full installation and setup information can be found on `Github <https://github.com/IBM/heart-library>`_.
Full installation and setup information can be found on `GitHub <https://github.com/IBM/heart-library>`_.


To install the latest version of HEART from PyPI, run:
Expand All @@ -33,7 +33,7 @@ To install the latest version of HEART from the heart-library public GitHub, run
(Optional) Development Environment via Poetry
It may be beneficial for developers to set up an environment from a reproducible source of truth. This environment is useful for developers that wish to work within a pull request or leverage the same development conditions used by HEART contributors. Please follow the instructions for installation via Poetry within the official HEART repository: https://github.com/IBM/heart-library/poetry_install.md
It may be beneficial for developers to set up an environment from a reproducible source of truth. This environment is useful for developers that wish to work within a pull request or leverage the same development conditions used by HEART contributors. Please follow the `instructions for installation via Poetry <https://github.com/IBM/heart-library/blob/main/poetry_installation.md>`_ within the official HEART GitHub repository.

.. code-block::
Expand All @@ -44,4 +44,4 @@ It may be beneficial for developers to set up an environment from a reproducible
If conda is not currently installed on your devices, instructions to do so can be found `here <https://docs.conda.io/projects/miniconda/en/latest/>`_


IBM has published a catalog of notebooks designed to assist developers of all skill levels with the process of getting started utilizing HEART in their AI T&E workflows. These Jupyter notebooks can be accessed within the official heart-library GitHub repository: `<https://github.com/IBM/heart-library/notebooks>`_
IBM has published a catalog of notebooks designed to assist developers of all skill levels with the process of getting started utilizing HEART in their AI T&E workflows. These Jupyter notebooks can be accessed within the official heart-library GitHub repository: `<https://github.com/IBM/heart-library/tree/main/notebooks>`_
Loading

0 comments on commit b875054

Please sign in to comment.