Skip to content

Commit

Permalink
close stale issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Weinstein authored and Ben Weinstein committed Aug 15, 2021
1 parent 73beea1 commit d339212
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
20 changes: 19 additions & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def on_train_end(self, trainer, pl_module):
trainer = Trainer(fast_dev_run=True)
trainer.fit(m, train_ds)

def test_save_and_reload(m, tmpdir):
def test_save_and_reload_checkpoint(m, tmpdir):
img_path = get_data(path="2019_YELL_2_528000_4978000_image_crop2.png")
m.config["train"]["fast_dev_run"] = True
m.create_trainer()
Expand All @@ -243,6 +243,24 @@ def test_save_and_reload(m, tmpdir):
assert not pred_after_reload.empty
pd.testing.assert_frame_equal(pred_after_train,pred_after_reload)

def test_save_and_reload_weights(m, tmpdir):
img_path = get_data(path="2019_YELL_2_528000_4978000_image_crop2.png")
m.config["train"]["fast_dev_run"] = True
m.create_trainer()
#save the prediction dataframe after training and compare with prediction after reload checkpoint
m.trainer.fit(m)
pred_after_train = m.predict_image(path = img_path)
torch.save(m.model.state_dict(),"{}/checkpoint.pt".format(tmpdir))

#reload the checkpoint to model object
after = main.deepforest()
after.model.load_state_dict(torch.load("{}/checkpoint.pt".format(tmpdir)))
pred_after_reload = after.predict_image(path = img_path)

assert not pred_after_train.empty
assert not pred_after_reload.empty
pd.testing.assert_frame_equal(pred_after_train,pred_after_reload)

def test_reload_multi_class(two_class_m, tmpdir):
two_class_m.config["train"]["fast_dev_run"] = True
two_class_m.create_trainer()
Expand Down

0 comments on commit d339212

Please sign in to comment.