Feature: Making the BaseOptions class compatible with jupyter notebooks#14
Open
Saad135 wants to merge 5 commits intomahmoodlab:masterfrom
Open
Feature: Making the BaseOptions class compatible with jupyter notebooks#14Saad135 wants to merge 5 commits intomahmoodlab:masterfrom
Saad135 wants to merge 5 commits intomahmoodlab:masterfrom
Conversation
…books For the parser to be used in jupyter notebooks, the command line arguments need to be manually put in a list and the passed to the parser. This change allows the option to pass either a list or none to the parser. If used within a script, None is passed to the parser and then the parser reads the command line args from the terminal. If a list is passed, the parser reads the arguments from the list. Before the change, None was the passed to the parser by default and thus it could not be used with a notebook.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feat: Modify BaseOptions class to make it compatible with Jupyter Notebooks
For the argument parser to be used in Jupyter Notebooks, the command line arguments need to be manually put in a list and the passed to the parser. This change allows the option to pass either a list or None to the parser. If used within a script, None is passed to the parser and then the parser reads the command line arguments from the terminal. If a list is passed, the parser reads the arguments from the list.
Before the change, None was the passed to the parser by default and thus it could not be used with a notebook.
The code inside the training and testing scripts, i.e. train.py and test.py, remains the same. Below is an example as to how the
TrainOptions.parse()method is used in Jupyter Notebooks.As for the training with a python script, such as
train.py, there needs to be no change while calling the parse method. For example:Other changes include deleting the byte-compiled .pyc files. Presence of these files cause an error when the code is used in jupyter notebooks. The .pyc files are auto-generated during compilation and placed in the
__pycache__folder. A.gitignorefile was also added, which is used to manage the files that is supposed to be excluded from version control. For example, Byte-compiled files, environment variables, etc.