Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 9d61831

Browse files
wat3rBrofacebook-github-bot
authored andcommitted
remove legacy code from beginner.ipynb
Summary: Pull Request resolved: #375 `patch_d2_meta_arch` had already been removed in D37246483 (d1518ff), need to also update the `beginner.ipynb`. Reviewed By: itomatik Differential Revision: D39861148 fbshipit-source-id: bac80efbff1f99a023d604a66c3667bc94f8c6f4
1 parent fc3a398 commit 9d61831

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.github/workflows/workflows.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ jobs:
3131
pip install git+https://github.com/facebookresearch/detectron2.git
3232
pip install git+https://github.com/facebookresearch/mobile-vision
3333
pip install scikit-learn
34-
pip install pytest
34+
pip install pytest nbval
3535
pip install -e .
3636
3737
- name: Run pytest
3838
run: |
3939
python -m unittest discover -v -s tests
40+
41+
- name: Test Notebooks
42+
run: |
43+
find . -name *.ipynb | CI=true xargs pytest --nbval-lax --current-env

demo/d2go_beginner.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@
531531
"metadata": {},
532532
"outputs": [],
533533
"source": [
534+
"import os\n",
534535
"from d2go.runner import GeneralizedRCNNRunner\n",
535536
"\n",
536537
"\n",
@@ -543,9 +544,10 @@
543544
" cfg.DATASETS.TEST = (\"balloon_val\",)\n",
544545
" cfg.DATALOADER.NUM_WORKERS = 2\n",
545546
" cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url(\"faster_rcnn_fbnetv3a_C4.yaml\") # Let training initialize from model zoo\n",
547+
" cfg.MODEL.DEVICE = \"cpu\" if ('CI' in os.environ) else \"cuda\"\n",
546548
" cfg.SOLVER.IMS_PER_BATCH = 2\n",
547549
" cfg.SOLVER.BASE_LR = 0.00025 # pick a good LR\n",
548-
" cfg.SOLVER.MAX_ITER = 600 # 600 iterations seems good enough for this toy dataset; you will need to train longer for a practical dataset\n",
550+
" cfg.SOLVER.MAX_ITER = 5 if ('CI' in os.environ) else 600 # 600 iterations seems good enough for this toy dataset; you will need to train longer for a practical dataset\n",
549551
" cfg.SOLVER.STEPS = [] # do not decay learning rate\n",
550552
" cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = 128 # faster, and good enough for this toy dataset (default: 512)\n",
551553
" cfg.MODEL.ROI_HEADS.NUM_CLASSES = 1 # only has one class (ballon). (see https://detectron2.readthedocs.io/tutorials/datasets.html#update-the-config-for-new-datasets)\n",
@@ -609,16 +611,13 @@
609611
"from detectron2.data import build_detection_test_loader\n",
610612
"from d2go.export.exporter import convert_and_export_predictor\n",
611613
"from d2go.utils.testing.data_loader_helper import create_detection_data_loader_on_toy_dataset\n",
612-
"from d2go.export.d2_meta_arch import patch_d2_meta_arch\n",
613614
"\n",
614615
"import logging\n",
615616
"\n",
616617
"# disable all the warnings\n",
617618
"previous_level = logging.root.manager.disable\n",
618619
"logging.disable(logging.INFO)\n",
619620
"\n",
620-
"patch_d2_meta_arch()\n",
621-
"\n",
622621
"cfg_name = 'faster_rcnn_fbnetv3a_dsmask_C4.yaml'\n",
623622
"pytorch_model = model_zoo.get(cfg_name, trained=True, device='cpu')\n",
624623
"pytorch_model.eval()\n",

0 commit comments

Comments
 (0)