-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for docs plots on GPU (#1229)
* Add tests for docs plots on GPU * Update to use path * Add license to file * Fix tests plots on gpu to run only on source files * Fix debug code * Fix plot detection tutorial * Fix Co-authored-by: Itay Gabbay <itay@deepchecks.com>
- Loading branch information
1 parent
0fc6e9c
commit 1f10d97
Showing
3 changed files
with
38 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# ---------------------------------------------------------------------------- | ||
# Copyright (C) 2021 Deepchecks (https://www.deepchecks.com) | ||
# | ||
# This file is part of Deepchecks. | ||
# Deepchecks is distributed under the terms of the GNU Affero General | ||
# Public License (version 3 or later). | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with Deepchecks. If not, see <http://www.gnu.org/licenses/>. | ||
# ---------------------------------------------------------------------------- | ||
# | ||
from pathlib import Path | ||
from runpy import run_path | ||
|
||
import torch | ||
import wandb | ||
|
||
# Since we have a plot that's calling `wandb.login` we need to setup first | ||
wandb.setup(wandb.Settings(mode="disabled", program=__name__, program_relpath=__name__, disable_code=True)) | ||
|
||
DOCS_COMPILED_DIR = 'examples' | ||
|
||
|
||
def test_plots_on_gpu(): | ||
"""If there is GPU available running all the docs plot files. Only makes sure the plots don't crash, and not \ | ||
testing any other display or functionality.""" | ||
if torch.cuda.is_available(): | ||
path = Path(__file__).parent.parent.parent.parent / "docs" / "source" | ||
|
||
# Take only source file and excluding compiled files | ||
source_files = set(path.glob("**/plot_*.py")) - set(path.glob(f"**/{DOCS_COMPILED_DIR}/plot_*.py")) | ||
if not source_files: | ||
raise ValueError("No plots found in docs/source") | ||
for file in source_files: | ||
run_path(str(file)) |