Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

[Draft] added types and docstring to wandb.init #122

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lukas
Copy link
Contributor

@lukas lukas commented Jul 31, 2020

Jeff - could you make sure you are happy this and I will try to add this kind of types and docstrings to all the external functions?

@lukas lukas requested a review from raubitsj July 31, 2020 22:31
@coveralls
Copy link

Pull Request Test Coverage Report for Build 15f5a8b6-f8e0-4c34-b4f4-a861695a429e

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 59.019%

Totals Coverage Status
Change from base Build 2702666c-98b4-482a-ab93-9b536c27394d: 0.0%
Covered Lines: 10359
Relevant Lines: 17552

💛 - Coveralls

Copy link
Contributor

@vanpelt vanpelt left a comment

Choose a reason for hiding this comment

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

In general this looks awesome, will be awesome to get our official SDK docs in order.

config: Union[Dict, None] = None, # TODO(jhr): type is a union for argparse/absl
project: Optional[str] = None,
entity: Optional[str] = None,
reinit: bool = None,
tags: Optional[List] = None,
team: Optional[str] = None,
team: Optional[str] = None, # LB What is this?
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it's an alias for entity. @raubitsj are we using this?

Copy link
Member

Choose a reason for hiding this comment

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

ill remove for now, we can add that later

config_exclude_keys=None,
config_include_keys=None,
config_exclude_keys: Optional[str] = None, # LB: Seems unsupported
config_include_keys: Optional[str] = None, # LB: Seems unsupported
Copy link
Contributor

Choose a reason for hiding this comment

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

@raubitsj what are our plans for hthis?

Copy link
Member

Choose a reason for hiding this comment

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

ill add them, they are trivial to add

settings: Union[Settings, Dict[str, Any], str, None] = None,
) -> Run:
"""Initialize a wandb Run.
disable: bool = None, # LB: What is this
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe disable is the same as WANDB_MODE=noop. It makes all the api calls noop's, this is useful for cases where code is run in a build environment like CI or docker builds.

) -> Run:
"""Initialize a wandb Run.
disable: bool = None, # LB: What is this
offline: bool = None, # LB: What is this
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the same as WANDB_MODE=dryrun, it won't connect to a server instead writing experiment data locally.

Copy link
Member

Choose a reason for hiding this comment

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

I am going to wire that up later this week.

offline is same as WANDB_MODE=dryrun
disable makes all methods noops (no logging locally)

"""Initialize a wandb Run.
disable: bool = None, # LB: What is this
offline: bool = None, # LB: What is this
allow_val_change: bool = None, # LB: What is this?
Copy link
Contributor

Choose a reason for hiding this comment

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

By default once a key in wandb.config is set, we don't allow you to change it. This is to prevent someone overwriting a sweep config value. Setting allow_val_change to True removes this check.

Copy link
Member

Choose a reason for hiding this comment

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

I am close to getting rid of that, but not ready yet

force: bool = None,
tensorboard: bool = None, # alias for sync_tensorboard, deprecated
sync_tensorboard: bool = None,
monitor_gym: bool = None, # LB: Currently unsupported
Copy link
Contributor

Choose a reason for hiding this comment

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

Jeff added this recently, it's now supported and automatically logs videos generated by openai gym.

Copy link
Member

Choose a reason for hiding this comment

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

yep

sync_tensorboard: bool = None,
monitor_gym: bool = None, # LB: Currently unsupported
id: Optional[str] = None,
settings: Union[Settings, Dict[str, Any], str, None] = None, # LB: What is this?
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a new wandb.Settings object that allows configuring all of these settings outside of calls to wandb.init. See https://github.com/wandb/client-ng/blob/master/wandb/sdk/wandb_settings.py#L193 another great candidate for a better doc string.

Copy link
Member

Choose a reason for hiding this comment

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

And on the docs page we really need to ducument classes not just methods
Config,Settings,Run,History,Summary


Returns:
wandb Run object

A wandb.run object for metric and config logging.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually a wandb.wandb_sdk.wandb_run.ManagedRun object. We might want to expose this in the global namespace as Run so users could do help wandb.Run. Another gotcha is that sometimes this is a DummyRun if we're in noop mode. @raubitsj thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

ManagedRun and DummyRun will be unified as Run... coming soon

@raubitsj
Copy link
Member

@lukas , thanks for the detailed look at supported features. We are doing the final push now to implement everything that is part of our function calls so I will give you the signal in a day or two: ~august 12th maybe when everything is ready.

@raubitsj
Copy link
Member

raubitsj commented Sep 2, 2020

@lukas The code is much closer, I have removed remnants of any new parameters that were not supported:

Things still not fully implemented:
force (still not supported) -- got to figure out really what this does and how to test it (something about login)
allow_val_override (still not supported, but i will add it before release). it is documented in wandb_config.py i think

New settings:
mode = this is like WANDB_MODE, the preferred strings are "online", "offline", but it works with "dryrun" also
settings = I dont want to document this for the 0.10.0 release, it needs work. (just say extra configuration)

@raubitsj raubitsj marked this pull request as draft September 2, 2020 21:53
@raubitsj raubitsj changed the title added types and docstring to wandb.init [Draft] added types and docstring to wandb.init Sep 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants