Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split trainer cli function into two functions #1197

Merged
merged 2 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions sleap/nn/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -1799,8 +1799,8 @@ def visualize_example(example):
)


def main(args: Optional[List] = None):
"""Create CLI for training and run."""
def create_trainer_using_cli(args: Optional[List] = None):
"""Create CLI for training."""
import argparse

parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -2004,10 +2004,15 @@ def main(args: Optional[List] = None):
test_labels=args.test_labels,
video_search_paths=args.video_paths,
)
trainer.train()

return trainer


def main(args: Optional[List] = None):
"""Create CLI for training and run."""
trainer = create_trainer_using_cli(args=args)
trainer.train()


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion tests/nn/test_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
TopdownConfmapsModelTrainer,
TopDownMultiClassModelTrainer,
Trainer,
main as sleap_train,
create_trainer_using_cli as sleap_train,
)

sleap.use_cpu_only()
Expand Down