-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Abolfazl Shahbazi <abolfazl.shahbazi@intel.com>
- Loading branch information
Showing
119 changed files
with
11,597 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
recursive-include explainer * | ||
recursive-include model_card_gen * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# | ||
# Copyright (c) 2022 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
ACTIVATE_TF = "intel_tf/bin/activate" | ||
ACTIVATE_PYT = "intel_pyt/bin/activate" | ||
ACTIVATE_TEST = "test_env/bin/activate" | ||
ACTIVATE_DOCS = $(ACTIVATE_TEST) | ||
ACTIVATE_NOTEBOOK = $(ACTIVATE_TEST) | ||
|
||
LISTEN_IP ?= 127.0.0.1 | ||
LISTEN_PORT ?= 9090 | ||
DOCS_DIR ?= docs | ||
|
||
venv-test: | ||
@echo "Creating a virtualenv test_env..." | ||
@test -d test_env || virtualenv -p python test_env | ||
|
||
@echo "Building the XAI API in test_env env..." | ||
@. $(ACTIVATE_TEST) && pip install --editable .[test] | ||
|
||
# TODO: running all tests in one pytest session randomly causes torch test to hang at last epoch | ||
test-torch: venv-test | ||
@echo "Testing the API..." | ||
@. $(ACTIVATE_TEST) && PYTHONPATH="$(CURDIR)/model_card_gen/tests" pytest -s model_card_gen/tests/test_end_to_end_torch.py | ||
|
||
test-mcg: test-torch | ||
@echo "Testing the API..." | ||
@. $(ACTIVATE_TEST) && PYTHONPATH="$(CURDIR)/model_card_gen/tests" pytest -s -k "not torch" | ||
|
||
install: | ||
@pip install --editable . | ||
|
||
xai-whl: | ||
@python setup.py bdist_wheel | ||
|
||
clean: | ||
@rm -rf build dist intel_xai_tools.egg-info | ||
@rm -rf test_env | ||
|
||
test-explainer: venv-test | ||
@. $(ACTIVATE_TEST) && pytest explainer/tests | ||
|
||
test: clean test-mcg test-explainer | ||
|
||
venv-docs: venv-test ${DOCS_DIR}/requirements-docs.txt | ||
@echo "Installing docs dependencies..." | ||
@. $(ACTIVATE_DOCS) && pip install -r ${DOCS_DIR}/requirements-docs.txt | ||
|
||
html: venv-docs | ||
@echo "Building Sphinx documentation..." | ||
@. $(ACTIVATE_DOCS) && $(MAKE) -C ${DOCS_DIR} clean html | ||
|
||
test-docs: html | ||
@echo "Testing Sphinx documentation..." | ||
@. $(ACTIVATE_DOCS) && $(MAKE) -C ${DOCS_DIR} doctest | ||
|
||
test-notebook: venv-test | ||
@echo "Testing Jupyter notebooks..." | ||
@. $(ACTIVATE_NOTEBOOK) && \ | ||
bash run_notebooks.sh $(CURDIR)/notebooks/explainer/imagenet_with_cam/ExplainingImageClassification.ipynb | ||
|
||
dist: venv-test | ||
@echo "Create binary wheel..." | ||
@. $(ACTIVATE_DOCS) && python setup.py bdist_wheel | ||
|
||
check-dist: dist | ||
@echo "Testing the wheel..." | ||
@. $(ACTIVATE_DOCS) && \ | ||
pip install twine && \ | ||
python setup.py bdist_wheel && \ | ||
twine check dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.ipynb_checkpoints | ||
_build | ||
markdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright (c) 2023 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
COMMAND=${1} | ||
|
||
# Temp directory within docs | ||
TEMP_DIR="markdown" | ||
|
||
if [[ ${COMMAND} == "clean" ]]; then | ||
rm -rf ${TEMP_DIR} | ||
elif [[ ${COMMAND} == "html" ]]; then | ||
# Create a temp directory for markdown files that are just used for sphinx docs | ||
mkdir -p ${TEMP_DIR} | ||
|
||
# This script takes sections out of the main README.md to create smaller .md files that are used for pages | ||
# in the sphinx doc table of contents (like Overview, Installation, Legal Information). | ||
# If heading name changes are made in the main README.md, they will need to be updated here too because the sed | ||
# commands are grabbing the text between two headers. | ||
|
||
# We don't want to mess with the original README.md, so create a copy of it before we start editing | ||
cp ../README.md ${TEMP_DIR}/Welcome.md | ||
|
||
# Convert links to go to sphinx docs | ||
sed -i 's#DATASETS.md#<datasets>#g' ${TEMP_DIR}/Welcome.md | ||
sed -i 's#notebooks\#model-card-generator-tutorial-notebooks#<notebooks>#g' ${TEMP_DIR}/Welcome.md | ||
sed -i 's#notebooks\#explainer-tutorial-notebooks#<notebooks>#g' ${TEMP_DIR}/Welcome.md | ||
|
||
# Create an Overview doc | ||
sed -n '/^ *## Overview *$/,/^ *## Get Started *$/p' ${TEMP_DIR}/Welcome.md > ${TEMP_DIR}/Overview.md | ||
# Change the first instance of Intel to include the registered trademark symbol | ||
sed -i '0,/Intel/{s/Intel/Intel®/}' ${TEMP_DIR}/Overview.md | ||
sed -i '$d' ${TEMP_DIR}/Overview.md | ||
echo "*Other names and brands may be claimed as the property of others. [Trademarks](http://www.intel.com/content/www/us/en/legal/trademarks.html)" >> ${TEMP_DIR}/Overview.md | ||
|
||
# Create an Installation doc (including requirements) | ||
echo "## Installation " > ${TEMP_DIR}/Install.md | ||
sed -n '/^ *### Requirements *$/,/^ *### Create and activate a Python3 virtual environment *$/p' ${TEMP_DIR}/Welcome.md >> ${TEMP_DIR}/Install.md | ||
sed -i '$d' ${TEMP_DIR}/Install.md | ||
sed -i 's/### Requirements/### Software Requirements/g' ${TEMP_DIR}/Install.md | ||
sed -n '/^ *### Create and activate a Python3 virtual environment *$/,/^ *## Running Notebooks *$/p' ${TEMP_DIR}/Welcome.md >> ${TEMP_DIR}/Install.md | ||
sed -i '$d' ${TEMP_DIR}/Install.md | ||
# Change the first instance of the tool name to include the registered trademark symbol | ||
sed -i '0,/Intel Transfer Learning Tool/{s/Intel Transfer Learning Tool/Intel® Transfer Learning Tool/}' ${TEMP_DIR}/Install.md | ||
echo "*Other names and brands may be claimed as the property of others. [Trademarks](http://www.intel.com/content/www/us/en/legal/trademarks.html)" >> ${TEMP_DIR}/Install.md | ||
|
||
# Create a Legal Information doc | ||
echo "# Legal Information " > ${TEMP_DIR}/Legal.md | ||
sed -n '/#### DISCLAIMER/,$p' ${TEMP_DIR}/Welcome.md >> ${TEMP_DIR}/Legal.md | ||
sed -i 's/#### DISCLAIMER/## Disclaimer/g' ${TEMP_DIR}/Legal.md | ||
sed -i 's/#### License/## License/g' ${TEMP_DIR}/Legal.md | ||
sed -i 's/#### Datasets/## Datasets/g' ${TEMP_DIR}/Legal.md | ||
# Change the first instance of Intel to include the registered trademark symbol | ||
sed -i '0,/Intel/{s/Intel/Intel®/}' ${TEMP_DIR}/Legal.md | ||
fi |
Oops, something went wrong.