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

Initial new API #361

Merged
merged 12 commits into from
Apr 24, 2024
Merged

Initial new API #361

merged 12 commits into from
Apr 24, 2024

Conversation

saeliddp
Copy link
Contributor

@saeliddp saeliddp commented Mar 29, 2024

What does this PR do?

This PR creates the groundwork for the new API. Note that this is definitely still a draft, and I'm mainly making this PR to get some feedback and ideas. The main principles I followed in creating the new API are below:

  1. each im2im experiment (configs/experiments/im2im) will get its own model class
  2. these experiment model classes will inherit from a generic model class
  3. the model classes train and predict methods will take as arguments all of the config items which are not reasonable to set a default for (e.g. checkpoint path)
  4. For config items which seem to have a reasonable default (e.g. the manifest column names), expose setters and getters

So, as an example use of the new API, we would have something like:

# train
model = SegmentationPluginModel() # uses default config
model.set_split_column("split")
model.train(5, Path("example/train.csv"), Path("example/output_dir"))
model.save_config(Path("example/config.yaml"))
...
# predict
model = SegmentationPluginModel(config_path=Path("example/config.yaml"))
model.predict(Path("example/predict.csv"), Path("example/output_dir"), Path("example/ckpt/last.ckpt"))

Before submitting

  • Did you make sure title is self-explanatory and the description concisely explains the PR?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you test your PR locally with pytest command?
  • Did you run pre-commit hooks with pre-commit run -a command?

Did you have fun?

Make sure you had fun coding 🙃

@saeliddp saeliddp marked this pull request as draft March 29, 2024 23:23
@saeliddp saeliddp requested a review from hughes036 March 29, 2024 23:30
hughes036
hughes036 previously approved these changes Apr 12, 2024
@saeliddp saeliddp mentioned this pull request Apr 15, 2024
5 tasks
…in_overrides

Move overrides to top-level config
Copy link
Contributor

@benjijamorris benjijamorris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it!

@benjijamorris
Copy link
Contributor

@yrkim98 @hughes036 bumping this, once it's reviewed I can incorporate all of our recent fixed into main.

@saeliddp saeliddp marked this pull request as ready for review April 24, 2024 19:32
tags: ["dev"]
seed: 12345

experiment_name: YOUR_EXP_NAME
run_name: YOUR_RUN_NAME
ckpt_path: null # must override for prediction
Copy link

@hughes036 hughes036 Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should ckpt_path value be MUST_OVERRIDE ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ckpt_path is not necessary for training, so I didn't want to use the MUST_OVERRIDE convention here

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, the comment makes sense then.

@saeliddp saeliddp merged commit d3107f9 into main Apr 24, 2024
3 of 6 checks passed
@saeliddp saeliddp deleted the feature/api_config_class branch April 24, 2024 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants