id int64 1 6.07M | name stringlengths 1 295 | code stringlengths 12 426k | language stringclasses 1
value | source_file stringlengths 5 202 | start_line int64 1 158k | end_line int64 1 158k | repo dict |
|---|---|---|---|---|---|---|---|
3,201 | __init__ | def __init__(self, settings: "Settings") -> None:
# TODO: warn if user doesn't have grpc installed
from wandb.sdk.service import service
self._settings = settings
self._atexit_lambda = None
self._hooks = None
self._service = service._Service(settings=self._settings)
# Temporary setting to allow use of grpc so that we can keep
# that code from rotting during the transition
use_grpc = self._settings._service_transport == "grpc"
token = _ManagerToken.from_environment()
if not token:
self._service.start()
host = "localhost"
if use_grpc:
transport = "grpc"
port = self._service.grpc_port
else:
transport = "tcp"
port = self._service.sock_port
assert port
token = _ManagerToken.from_params(transport=transport, host=host, port=port)
token.set_environment()
self._atexit_setup()
self._token = token
try:
self._service_connect()
except ManagerConnectionError as e:
wandb._sentry.reraise(e) | python | wandb/sdk/wandb_manager.py | 129 | 163 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,202 | _atexit_setup | def _atexit_setup(self) -> None:
self._atexit_lambda = lambda: self._atexit_teardown()
self._hooks = ExitHooks()
self._hooks.hook()
atexit.register(self._atexit_lambda) | python | wandb/sdk/wandb_manager.py | 165 | 170 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,203 | _atexit_teardown | def _atexit_teardown(self) -> None:
trigger.call("on_finished")
exit_code = self._hooks.exit_code if self._hooks else 0
self._teardown(exit_code) | python | wandb/sdk/wandb_manager.py | 172 | 175 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,204 | _teardown | def _teardown(self, exit_code: int) -> None:
unregister_all_post_import_hooks()
if self._atexit_lambda:
atexit.unregister(self._atexit_lambda)
self._atexit_lambda = None
try:
self._inform_teardown(exit_code)
result = self._service.join()
if result and not self._settings._jupyter:
os._exit(result)
except Exception as e:
wandb.termlog(
f"While tearing down the service manager. The following error has occurred: {e}",
repeat=False,
)
finally:
self._token.reset_environment() | python | wandb/sdk/wandb_manager.py | 177 | 195 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,205 | _get_service | def _get_service(self) -> "service._Service":
return self._service | python | wandb/sdk/wandb_manager.py | 197 | 198 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,206 | _get_service_interface | def _get_service_interface(self) -> "ServiceInterface":
assert self._service
svc_iface = self._service.service_interface
assert svc_iface
return svc_iface | python | wandb/sdk/wandb_manager.py | 200 | 204 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,207 | _inform_init | def _inform_init(self, settings: "Settings", run_id: str) -> None:
svc_iface = self._get_service_interface()
svc_iface._svc_inform_init(settings=settings, run_id=run_id) | python | wandb/sdk/wandb_manager.py | 206 | 208 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,208 | _inform_start | def _inform_start(self, settings: "Settings", run_id: str) -> None:
svc_iface = self._get_service_interface()
svc_iface._svc_inform_start(settings=settings, run_id=run_id) | python | wandb/sdk/wandb_manager.py | 210 | 212 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,209 | _inform_attach | def _inform_attach(self, attach_id: str) -> Optional[Dict[str, Any]]:
svc_iface = self._get_service_interface()
try:
response = svc_iface._svc_inform_attach(attach_id=attach_id)
except Exception:
return None
return settings_dict_from_pbmap(response._settings_map) | python | wandb/sdk/wandb_manager.py | 214 | 220 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,210 | _inform_finish | def _inform_finish(self, run_id: Optional[str] = None) -> None:
svc_iface = self._get_service_interface()
svc_iface._svc_inform_finish(run_id=run_id) | python | wandb/sdk/wandb_manager.py | 222 | 224 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,211 | _inform_teardown | def _inform_teardown(self, exit_code: int) -> None:
svc_iface = self._get_service_interface()
svc_iface._svc_inform_teardown(exit_code) | python | wandb/sdk/wandb_manager.py | 226 | 228 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,212 | _set_logger | def _set_logger(log_object: Logger) -> None:
"""Configure module logger."""
global logger
logger = log_object | python | wandb/sdk/wandb_setup.py | 36 | 39 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,213 | __init__ | def __init__(self) -> None:
self._log: List[tuple] = []
self._exception: List[tuple] = []
# support old warn() as alias of warning()
self.warn = self.warning | python | wandb/sdk/wandb_setup.py | 45 | 49 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,214 | debug | def debug(self, msg: str, *args: Any, **kwargs: Any) -> None:
self._log.append((logging.DEBUG, msg, args, kwargs)) | python | wandb/sdk/wandb_setup.py | 51 | 52 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,215 | info | def info(self, msg: str, *args: Any, **kwargs: Any) -> None:
self._log.append((logging.INFO, msg, args, kwargs)) | python | wandb/sdk/wandb_setup.py | 54 | 55 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,216 | warning | def warning(self, msg: str, *args: Any, **kwargs: Any) -> None:
self._log.append((logging.WARNING, msg, args, kwargs)) | python | wandb/sdk/wandb_setup.py | 57 | 58 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,217 | error | def error(self, msg: str, *args: Any, **kwargs: Any) -> None:
self._log.append((logging.ERROR, msg, args, kwargs)) | python | wandb/sdk/wandb_setup.py | 60 | 61 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,218 | critical | def critical(self, msg: str, *args: Any, **kwargs: Any) -> None:
self._log.append((logging.CRITICAL, msg, args, kwargs)) | python | wandb/sdk/wandb_setup.py | 63 | 64 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,219 | exception | def exception(self, msg: str, *args: Any, **kwargs: Any) -> None:
self._exception.append((msg, args, kwargs)) | python | wandb/sdk/wandb_setup.py | 66 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,220 | log | def log(self, level: str, msg: str, *args: Any, **kwargs: Any) -> None:
self._log.append((level, msg, args, kwargs)) | python | wandb/sdk/wandb_setup.py | 69 | 70 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,221 | _flush | def _flush(self) -> None:
assert self is not logger
assert logger is not None
for level, msg, args, kwargs in self._log:
logger.log(level, msg, *args, **kwargs)
for msg, args, kwargs in self._exception:
logger.exception(msg, *args, **kwargs) | python | wandb/sdk/wandb_setup.py | 72 | 78 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,222 | __init__ | def __init__(
self,
pid: int,
settings: Optional[Settings] = None,
environ: Optional[Dict[str, Any]] = None,
) -> None:
self._environ = environ or dict(os.environ)
self._sweep_config: Optional[Dict[str, Any]] = None
self._config: Optional[Dict[str, Any]] = None
self._server: Optional[server.Server] = None
self._manager: Optional[wandb_manager._Manager] = None
self._pid = pid
# keep track of multiple runs, so we can unwind with join()s
self._global_run_stack: List["wandb_run.Run"] = []
# TODO(jhr): defer strict checks until settings are fully initialized
# and logging is ready
self._early_logger = _EarlyLogger()
_set_logger(self._early_logger)
self._settings = self._settings_setup(settings, self._early_logger)
# self._settings.freeze()
wandb.termsetup(self._settings, logger)
self._check()
self._setup()
tracelog_mode = self._settings._tracelog
if tracelog_mode:
tracelog.enable(tracelog_mode) | python | wandb/sdk/wandb_setup.py | 87 | 118 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,223 | _settings_setup | def _settings_setup(
self,
settings: Optional[Settings] = None,
early_logger: Optional[_EarlyLogger] = None,
) -> "wandb_settings.Settings":
s = wandb_settings.Settings()
s._apply_base(pid=self._pid, _logger=early_logger)
s._apply_config_files(_logger=early_logger)
s._apply_env_vars(self._environ, _logger=early_logger)
if isinstance(settings, wandb_settings.Settings):
s._apply_settings(settings, _logger=early_logger)
elif isinstance(settings, dict):
# if passed settings arg is a mapping, update the settings with it
s._apply_setup(settings, _logger=early_logger)
s._infer_settings_from_environment()
if not s._cli_only_mode:
s._infer_run_settings_from_environment(_logger=early_logger)
return s | python | wandb/sdk/wandb_setup.py | 120 | 140 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,224 | _update | def _update(
self,
settings: Optional[Settings] = None,
) -> None:
if settings is None:
return
# self._settings.unfreeze()
if isinstance(settings, wandb_settings.Settings):
# todo: check the logic here. this _only_ comes up in tests?
self._settings._apply_settings(settings)
elif isinstance(settings, dict):
# if it is a mapping, update the settings with it
self._settings.update(settings, source=wandb_settings.Source.SETUP)
# self._settings.freeze() | python | wandb/sdk/wandb_setup.py | 142 | 155 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,225 | _update_user_settings | def _update_user_settings(self, settings: Optional[Settings] = None) -> None:
settings = settings or self._settings
# Get rid of cached results to force a refresh.
self._server = None
user_settings = self._load_user_settings(settings=settings)
if user_settings is not None:
# self._settings.unfreeze()
self._settings._apply_user(user_settings)
# self._settings.freeze() | python | wandb/sdk/wandb_setup.py | 157 | 165 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,226 | _early_logger_flush | def _early_logger_flush(self, new_logger: Logger) -> None:
if not self._early_logger:
return
_set_logger(new_logger)
# self._settings._clear_early_logger()
self._early_logger._flush() | python | wandb/sdk/wandb_setup.py | 167 | 172 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,227 | _get_logger | def _get_logger(self) -> Optional[Logger]:
return logger | python | wandb/sdk/wandb_setup.py | 174 | 175 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,228 | settings | def settings(self) -> "wandb_settings.Settings":
return self._settings | python | wandb/sdk/wandb_setup.py | 178 | 179 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,229 | _get_entity | def _get_entity(self) -> Optional[str]:
if self._settings and self._settings._offline:
return None
if self._server is None:
self._load_viewer()
assert self._server is not None
entity = self._server._viewer.get("entity")
return entity | python | wandb/sdk/wandb_setup.py | 181 | 188 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,230 | _get_username | def _get_username(self) -> Optional[str]:
if self._settings and self._settings._offline:
return None
if self._server is None:
self._load_viewer()
assert self._server is not None
username = self._server._viewer.get("username")
return username | python | wandb/sdk/wandb_setup.py | 190 | 197 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,231 | _get_teams | def _get_teams(self) -> List[str]:
if self._settings and self._settings._offline:
return []
if self._server is None:
self._load_viewer()
assert self._server is not None
teams = self._server._viewer.get("teams")
if teams:
teams = [team["node"]["name"] for team in teams["edges"]]
return teams or [] | python | wandb/sdk/wandb_setup.py | 199 | 208 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,232 | _load_viewer | def _load_viewer(self, settings: Optional[Settings] = None) -> None:
if self._settings and self._settings._offline:
return
if isinstance(settings, dict):
settings = wandb_settings.Settings(**settings)
s = server.Server(settings=settings)
s.query_with_timeout()
self._server = s | python | wandb/sdk/wandb_setup.py | 210 | 217 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,233 | _load_user_settings | def _load_user_settings(
self, settings: Optional[Settings] = None
) -> Optional[Dict[str, Any]]:
if self._server is None:
self._load_viewer(settings=settings)
# offline?
if self._server is None:
return None
flags = self._server._flags
user_settings = dict()
if "code_saving_enabled" in flags:
user_settings["save_code"] = flags["code_saving_enabled"]
email = self._server._viewer.get("email", None)
if email:
user_settings["email"] = email
return user_settings | python | wandb/sdk/wandb_setup.py | 219 | 238 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,234 | _check | def _check(self) -> None:
if hasattr(threading, "main_thread"):
if threading.current_thread() is not threading.main_thread():
pass
elif threading.current_thread().name != "MainThread":
print("bad thread2", threading.current_thread().name)
if getattr(sys, "frozen", False):
print("frozen, could be trouble") | python | wandb/sdk/wandb_setup.py | 240 | 247 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,235 | _setup | def _setup(self) -> None:
self._setup_manager()
sweep_path = self._settings.sweep_param_path
if sweep_path:
self._sweep_config = config_util.dict_from_config_file(
sweep_path, must_exist=True
)
# if config_paths was set, read in config dict
if self._settings.config_paths:
# TODO(jhr): handle load errors, handle list of files
for config_path in self._settings.config_paths:
config_dict = config_util.dict_from_config_file(config_path)
if config_dict is None:
continue
if self._config is not None:
self._config.update(config_dict)
else:
self._config = config_dict | python | wandb/sdk/wandb_setup.py | 249 | 268 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,236 | _teardown | def _teardown(self, exit_code: Optional[int] = None) -> None:
exit_code = exit_code or 0
self._teardown_manager(exit_code=exit_code) | python | wandb/sdk/wandb_setup.py | 270 | 272 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,237 | _setup_manager | def _setup_manager(self) -> None:
if self._settings._disable_service:
return
self._manager = wandb_manager._Manager(settings=self._settings) | python | wandb/sdk/wandb_setup.py | 274 | 277 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,238 | _teardown_manager | def _teardown_manager(self, exit_code: int) -> None:
if not self._manager:
return
self._manager._teardown(exit_code)
self._manager = None | python | wandb/sdk/wandb_setup.py | 279 | 283 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,239 | _get_manager | def _get_manager(self) -> Optional[wandb_manager._Manager]:
return self._manager | python | wandb/sdk/wandb_setup.py | 285 | 286 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,240 | __init__ | def __init__(self, settings: Optional[Settings] = None) -> None:
pid = os.getpid()
if _WandbSetup._instance and _WandbSetup._instance._pid == pid:
_WandbSetup._instance._update(settings=settings)
return
_WandbSetup._instance = _WandbSetup__WandbSetup(settings=settings, pid=pid) | python | wandb/sdk/wandb_setup.py | 298 | 303 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,241 | __getattr__ | def __getattr__(self, name: str) -> Any:
return getattr(self._instance, name) | python | wandb/sdk/wandb_setup.py | 305 | 306 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,242 | _setup | def _setup(
settings: Optional[Settings] = None,
_reset: bool = False,
) -> Optional["_WandbSetup"]:
"""Set up library context."""
if _reset:
setup_instance = _WandbSetup._instance
if setup_instance:
setup_instance._teardown()
_WandbSetup._instance = None
return None
wl = _WandbSetup(settings=settings)
return wl | python | wandb/sdk/wandb_setup.py | 309 | 321 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,243 | setup | def setup(
settings: Optional[Settings] = None,
) -> Optional["_WandbSetup"]:
ret = _setup(settings=settings)
return ret | python | wandb/sdk/wandb_setup.py | 324 | 328 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,244 | teardown | def teardown(exit_code: Optional[int] = None) -> None:
setup_instance = _WandbSetup._instance
if setup_instance:
setup_instance._teardown(exit_code=exit_code)
_WandbSetup._instance = None | python | wandb/sdk/wandb_setup.py | 331 | 335 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,245 | requires | def requires(requirement: str) -> FuncT: # type: ignore
"""Decorate functions to gate features with wandb.require."""
env_var = requirement_env_var_mapping[requirement]
def deco(func: FuncT) -> FuncT:
@wraps(func)
def wrapper(*args: Any, **kwargs: Any) -> Any:
if not os.getenv(env_var):
raise Exception(
f"You need to enable this feature with `wandb.require({requirement!r})`"
)
return func(*args, **kwargs)
return cast(FuncT, wrapper)
return cast(FuncT, deco) | python | wandb/sdk/wandb_require_helpers.py | 12 | 27 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,246 | deco | def deco(func: FuncT) -> FuncT:
@wraps(func)
def wrapper(*args: Any, **kwargs: Any) -> Any:
if not os.getenv(env_var):
raise Exception(
f"You need to enable this feature with `wandb.require({requirement!r})`"
)
return func(*args, **kwargs)
return cast(FuncT, wrapper) | python | wandb/sdk/wandb_require_helpers.py | 16 | 25 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,247 | wrapper | def wrapper(*args: Any, **kwargs: Any) -> Any:
if not os.getenv(env_var):
raise Exception(
f"You need to enable this feature with `wandb.require({requirement!r})`"
)
return func(*args, **kwargs) | python | wandb/sdk/wandb_require_helpers.py | 18 | 23 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,248 | __init__ | def __init__(self) -> None:
self._check_if_requirements_met() | python | wandb/sdk/wandb_require_helpers.py | 33 | 34 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,249 | __post_init__ | def __post_init__(self) -> None:
self._check_if_requirements_met() | python | wandb/sdk/wandb_require_helpers.py | 36 | 37 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,250 | _check_if_requirements_met | def _check_if_requirements_met(self) -> None:
env_var = requirement_env_var_mapping[self.requirement]
if not os.getenv(env_var):
raise Exception(
f'You must explicitly enable this feature with `wandb.require("{self.requirement})"'
) | python | wandb/sdk/wandb_require_helpers.py | 39 | 44 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,251 | __init__ | def __init__(
self,
inputs: Union[Sequence, Dict[str, Sequence]],
targets: Optional[Union[Sequence, Dict[str, Sequence]]] = None,
indexes: Optional[List["_TableIndex"]] = None,
validation_row_processor: Optional[Callable] = None,
prediction_row_processor: Optional[Callable] = None,
input_col_name: str = "input",
target_col_name: str = "target",
table_name: str = "wb_validation_data",
artifact_type: str = "validation_dataset",
class_labels: Optional[List[str]] = None,
infer_missing_processors: bool = True,
) -> None:
"""Initialize a new ValidationDataLogger.
Args:
inputs: A list of input vectors or dictionary of lists of input vectors
(used if the model has multiple named inputs)
targets: A list of target vectors or dictionary of lists of target vectors
(used if the model has multiple named targets/putputs). Defaults to `None`.
`targets` and `indexes` cannot both be `None`.
indexes: An ordered list of `wandb.data_types._TableIndex` mapping the
input items to their source table. This is most commonly retrieved by using
`indexes = my_data_table.get_index()`. Defaults to `None`. `targets`
and `indexes` cannot both be `None`.
validation_row_processor: A function to apply to the validation data,
commonly used to visualize the data. The function will receive an `ndx` (`int`)
and a `row` (`dict`). If `inputs` is a list, then `row["input"]` will be the input
data for the row. Else, it will be keyed based on the name of the input slot
(corresponding to `inputs`). If `targets` is a list, then
`row["target"]` will be the target data for the row. Else, it will
be keyed based on `targets`. For example, if your input data is a
single ndarray, but you wish to visualize the data as an image,
then you can provide `lambda ndx, row: {"img": wandb.Image(row["input"])}`
as the processor. If `None`, we will try to guess the appropriate processor.
Ignored if `log_evaluation` is `False` or `val_keys` are present. Defaults to `None`.
prediction_row_processor: Same as validation_row_processor, but applied to the
model's output. `row["output"]` will contain the results of the model output.
Defaults to `None`.
input_col_name: The name to use for the input column.
Defaults to `"input"`.
target_col_name: The name to use for the target column.
Defaults to `"target"`.
table_name: The name to use for the validation table.
Defaults to `"wb_validation_data"`.
artifact_type: The artifact type to use for the validation data.
Defaults to `"validation_dataset"`.
class_labels: Optional list of lables to use in the inferred
processors. If the model's `target` or `output` is inferred to be a class,
we will attempt to map the class to these labels. Defaults to `None`.
infer_missing_processors: Determines if processors are inferred if
they are missing. Defaults to True.
"""
class_labels_table: Optional["wandb.Table"]
if isinstance(class_labels, list) and len(class_labels) > 0:
class_labels_table = wandb.Table(
columns=["label"], data=[[label] for label in class_labels]
)
else:
class_labels_table = None
if indexes is None:
assert targets is not None
local_validation_table = wandb.Table(columns=[], data=[])
if isinstance(targets, dict):
for col_name in targets:
local_validation_table.add_column(col_name, targets[col_name])
else:
local_validation_table.add_column(target_col_name, targets)
if isinstance(inputs, dict):
for col_name in inputs:
local_validation_table.add_column(col_name, inputs[col_name])
else:
local_validation_table.add_column(input_col_name, inputs)
if validation_row_processor is None and infer_missing_processors:
example_input = _make_example(inputs)
example_target = _make_example(targets)
if example_input is not None and example_target is not None:
validation_row_processor = _infer_validation_row_processor(
example_input,
example_target,
class_labels_table,
input_col_name,
target_col_name,
)
if validation_row_processor is not None:
local_validation_table.add_computed_columns(validation_row_processor)
local_validation_artifact = wandb.Artifact(table_name, artifact_type)
local_validation_artifact.add(local_validation_table, "validation_data")
if wandb.run:
wandb.run.use_artifact(local_validation_artifact)
indexes = local_validation_table.get_index()
else:
local_validation_artifact = None
self.class_labels_table = class_labels_table
self.validation_inputs = inputs
self.validation_targets = targets
self.validation_indexes = indexes
self.prediction_row_processor = prediction_row_processor
self.infer_missing_processors = infer_missing_processors
self.local_validation_artifact = local_validation_artifact
self.input_col_name = input_col_name | python | wandb/sdk/integration_utils/data_logging.py | 33 | 141 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,252 | make_predictions | def make_predictions(
self, predict_fn: Callable
) -> Union[Sequence, Dict[str, Sequence]]:
"""Produce predictions by passing `validation_inputs` to `predict_fn`.
Args:
predict_fn (Callable): Any function which can accept `validation_inputs` and produce
a list of vectors or dictionary of lists of vectors
Returns:
(Sequence | Dict[str, Sequence]): The returned value of predict_fn
"""
return predict_fn(self.validation_inputs) | python | wandb/sdk/integration_utils/data_logging.py | 143 | 155 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,253 | log_predictions | def log_predictions(
self,
predictions: Union[Sequence, Dict[str, Sequence]],
prediction_col_name: str = "output",
val_ndx_col_name: str = "val_row",
table_name: str = "validation_predictions",
commit: bool = True,
) -> wandb.data_types.Table:
"""Log a set of predictions.
Intended usage:
vl.log_predictions(vl.make_predictions(self.model.predict))
Args:
predictions (Sequence | Dict[str, Sequence]): A list of prediction vectors or dictionary
of lists of prediction vectors
prediction_col_name (str, optional): the name of the prediction column. Defaults to "output".
val_ndx_col_name (str, optional): The name of the column linking prediction table
to the validation ata table. Defaults to "val_row".
table_name (str, optional): name of the prediction table. Defaults to "validation_predictions".
commit (bool, optional): determines if commit should be called on the logged data. Defaults to False.
"""
pred_table = wandb.Table(columns=[], data=[])
if isinstance(predictions, dict):
for col_name in predictions:
pred_table.add_column(col_name, predictions[col_name])
else:
pred_table.add_column(prediction_col_name, predictions)
pred_table.add_column(val_ndx_col_name, self.validation_indexes)
if self.prediction_row_processor is None and self.infer_missing_processors:
example_prediction = _make_example(predictions)
example_input = _make_example(self.validation_inputs)
if example_prediction is not None and example_input is not None:
self.prediction_row_processor = _infer_prediction_row_processor(
example_prediction,
example_input,
self.class_labels_table,
self.input_col_name,
prediction_col_name,
)
if self.prediction_row_processor is not None:
pred_table.add_computed_columns(self.prediction_row_processor)
wandb.log({table_name: pred_table}, commit=commit)
return pred_table | python | wandb/sdk/integration_utils/data_logging.py | 157 | 204 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,254 | _make_example | def _make_example(data: Any) -> Optional[Union[Dict, Sequence, Any]]:
"""Used to make an example input, target, or output."""
example: Optional[Union[Dict, Sequence, Any]]
if isinstance(data, dict):
example = {}
for key in data:
example[key] = data[key][0]
elif hasattr(data, "__len__"):
example = data[0]
else:
example = None
return example | python | wandb/sdk/integration_utils/data_logging.py | 207 | 220 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,255 | _get_example_shape | def _get_example_shape(example: Union[Sequence, Any]):
"""Get the shape of an object if applicable."""
shape = []
if type(example) is not str and hasattr(example, "__len__"):
length = len(example)
shape = [length]
if length > 0:
shape += _get_example_shape(example[0])
return shape | python | wandb/sdk/integration_utils/data_logging.py | 223 | 231 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,256 | _bind | def _bind(lambda_fn: Callable, **closure_kwargs: Any) -> Callable:
"""Create a closure around a lambda function by binding `closure_kwargs` to the function."""
def closure(*args: Any, **kwargs: Any) -> Any:
_k = {}
_k.update(kwargs)
_k.update(closure_kwargs)
return lambda_fn(*args, **_k)
return closure | python | wandb/sdk/integration_utils/data_logging.py | 234 | 243 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,257 | closure | def closure(*args: Any, **kwargs: Any) -> Any:
_k = {}
_k.update(kwargs)
_k.update(closure_kwargs)
return lambda_fn(*args, **_k) | python | wandb/sdk/integration_utils/data_logging.py | 237 | 241 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,258 | _infer_single_example_keyed_processor | def _infer_single_example_keyed_processor(
example: Union[Sequence, Any],
class_labels_table: Optional["wandb.Table"] = None,
possible_base_example: Optional[Union[Sequence, Any]] = None,
) -> Dict[str, Callable]:
"""Infers a processor from a single example.
Infers a processor from a single example with optional class_labels_table
and base_example. Base example is useful for cases such as segmentation masks
"""
shape = _get_example_shape(example)
processors: Dict[str, Callable] = {}
if (
class_labels_table is not None
and len(shape) == 1
and shape[0] == len(class_labels_table.data)
):
np = wandb.util.get_module(
"numpy",
required="Infering processors require numpy",
)
# Assume these are logits
class_names = class_labels_table.get_column("label")
processors["max_class"] = lambda n, d, p: class_labels_table.index_ref( # type: ignore
np.argmax(d)
)
# TODO: Consider adding back if users ask
# processors["min_class"] = lambda n, d, p: class_labels_table.index_ref( # type: ignore
# np.argmin(d)
# )
values = np.unique(example)
is_one_hot = len(values) == 2 and set(values) == {0, 1}
if not is_one_hot:
processors["score"] = lambda n, d, p: {
class_names[i]: d[i] for i in range(shape[0])
}
elif (
len(shape) == 1
and shape[0] == 1
and (
isinstance(example[0], int)
or (hasattr(example, "tolist") and isinstance(example.tolist()[0], int)) # type: ignore
)
):
# assume this is a class
if class_labels_table is not None:
processors["class"] = lambda n, d, p: class_labels_table.index_ref(d[0]) if d[0] < len(class_labels_table.data) else d[0] # type: ignore
else:
processors["val"] = lambda n, d, p: d[0]
elif len(shape) == 1:
np = wandb.util.get_module(
"numpy",
required="Infering processors require numpy",
)
# This could be anything
if shape[0] <= 10:
# if less than 10, fan out the results
# processors["node"] = lambda n, d, p: {i: d[i] for i in range(shape[0])}
processors["node"] = lambda n, d, p: [
d[i].tolist() if hasattr(d[i], "tolist") else d[i]
for i in range(shape[0])
]
# just report the argmax and argmin
processors["argmax"] = lambda n, d, p: np.argmax(d)
values = np.unique(example)
is_one_hot = len(values) == 2 and set(values) == {0, 1}
if not is_one_hot:
processors["argmin"] = lambda n, d, p: np.argmin(d)
elif len(shape) == 2 and CAN_INFER_IMAGE_AND_VIDEO:
if (
class_labels_table is not None
and possible_base_example is not None
and shape == _get_example_shape(possible_base_example)
):
# consider this a segmentation mask
processors["image"] = lambda n, d, p: wandb.Image(
p,
masks={
"masks": {
"mask_data": d,
"class_labels": class_labels_table.get_column("label"), # type: ignore
}
},
)
else:
# consider this a 2d image
processors["image"] = lambda n, d, p: wandb.Image(d)
elif len(shape) == 3 and CAN_INFER_IMAGE_AND_VIDEO:
# consider this an image
processors["image"] = lambda n, d, p: wandb.Image(d)
elif len(shape) == 4 and CAN_INFER_IMAGE_AND_VIDEO:
# consider this a video
processors["video"] = lambda n, d, p: wandb.Video(d)
return processors | python | wandb/sdk/integration_utils/data_logging.py | 246 | 343 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,259 | _infer_validation_row_processor | def _infer_validation_row_processor(
example_input: Union[Dict, Sequence],
example_target: Union[Dict, Sequence, Any],
class_labels_table: Optional["wandb.Table"] = None,
input_col_name: str = "input",
target_col_name: str = "target",
) -> Callable:
"""Infers the composit processor for the validation data."""
single_processors = {}
if isinstance(example_input, dict):
for key in example_input:
key_processors = _infer_single_example_keyed_processor(example_input[key])
for p_key in key_processors:
single_processors[f"{key}:{p_key}"] = _bind(
lambda ndx, row, key_processor, key: key_processor(
ndx,
row[key],
None,
),
key_processor=key_processors[p_key],
key=key,
)
else:
key = input_col_name
key_processors = _infer_single_example_keyed_processor(example_input)
for p_key in key_processors:
single_processors[f"{key}:{p_key}"] = _bind(
lambda ndx, row, key_processor, key: key_processor(
ndx,
row[key],
None,
),
key_processor=key_processors[p_key],
key=key,
)
if isinstance(example_target, dict):
for key in example_target:
key_processors = _infer_single_example_keyed_processor(
example_target[key], class_labels_table
)
for p_key in key_processors:
single_processors[f"{key}:{p_key}"] = _bind(
lambda ndx, row, key_processor, key: key_processor(
ndx,
row[key],
None,
),
key_processor=key_processors[p_key],
key=key,
)
else:
key = target_col_name
key_processors = _infer_single_example_keyed_processor(
example_target,
class_labels_table,
example_input if not isinstance(example_input, dict) else None,
)
for p_key in key_processors:
single_processors[f"{key}:{p_key}"] = _bind(
lambda ndx, row, key_processor, key: key_processor(
ndx,
row[key],
row[input_col_name]
if not isinstance(example_input, dict)
else None,
),
key_processor=key_processors[p_key],
key=key,
)
def processor(ndx, row):
return {key: single_processors[key](ndx, row) for key in single_processors}
return processor | python | wandb/sdk/integration_utils/data_logging.py | 346 | 420 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,260 | processor | def processor(ndx, row):
return {key: single_processors[key](ndx, row) for key in single_processors} | python | wandb/sdk/integration_utils/data_logging.py | 417 | 418 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,261 | _infer_prediction_row_processor | def _infer_prediction_row_processor(
example_prediction: Union[Dict, Sequence],
example_input: Union[Dict, Sequence],
class_labels_table: Optional["wandb.Table"] = None,
input_col_name: str = "input",
output_col_name: str = "output",
) -> Callable:
"""Infers the composit processor for the prediction output data."""
single_processors = {}
if isinstance(example_prediction, dict):
for key in example_prediction:
key_processors = _infer_single_example_keyed_processor(
example_prediction[key], class_labels_table
)
for p_key in key_processors:
single_processors[f"{key}:{p_key}"] = _bind(
lambda ndx, row, key_processor, key: key_processor(
ndx,
row[key],
None,
),
key_processor=key_processors[p_key],
key=key,
)
else:
key = output_col_name
key_processors = _infer_single_example_keyed_processor(
example_prediction,
class_labels_table,
example_input if not isinstance(example_input, dict) else None,
)
for p_key in key_processors:
single_processors[f"{key}:{p_key}"] = _bind(
lambda ndx, row, key_processor, key: key_processor(
ndx,
row[key],
ndx.get_row().get("val_row").get_row().get(input_col_name)
if not isinstance(example_input, dict)
else None,
),
key_processor=key_processors[p_key],
key=key,
)
def processor(ndx, row):
return {key: single_processors[key](ndx, row) for key in single_processors}
return processor | python | wandb/sdk/integration_utils/data_logging.py | 423 | 471 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,262 | processor | def processor(ndx, row):
return {key: single_processors[key](ndx, row) for key in single_processors} | python | wandb/sdk/integration_utils/data_logging.py | 468 | 469 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,263 | __init__ | def __init__(
self,
mailbox: Mailbox,
record_q: Optional["Queue[pb.Record]"] = None,
result_q: Optional["Queue[pb.Result]"] = None,
relay_q: Optional["Queue[pb.Result]"] = None,
process: Optional[BaseProcess] = None,
process_check: bool = True,
) -> None:
self.relay_q = relay_q
super().__init__(
record_q=record_q,
result_q=result_q,
process=process,
process_check=process_check,
mailbox=mailbox,
) | python | wandb/sdk/interface/interface_relay.py | 28 | 44 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,264 | _init_router | def _init_router(self) -> None:
if self.record_q and self.result_q and self.relay_q:
self._router = MessageRelayRouter(
request_queue=self.record_q,
response_queue=self.result_q,
relay_queue=self.relay_q,
mailbox=self._mailbox,
) | python | wandb/sdk/interface/interface_relay.py | 46 | 53 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,265 | __init__ | def __init__(
self,
request_queue: "Queue[pb.Record]",
response_queue: "Queue[pb.Result]",
mailbox: Optional[Mailbox] = None,
) -> None:
self._request_queue = request_queue
self._response_queue = response_queue
super().__init__(mailbox=mailbox) | python | wandb/sdk/interface/router_queue.py | 24 | 32 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,266 | _read_message | def _read_message(self) -> Optional["pb.Result"]:
try:
msg = self._response_queue.get(timeout=1)
except queue.Empty:
return None
tracelog.log_message_dequeue(msg, self._response_queue)
return msg | python | wandb/sdk/interface/router_queue.py | 34 | 40 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,267 | _send_message | def _send_message(self, record: "pb.Record") -> None:
tracelog.log_message_queue(record, self._request_queue)
self._request_queue.put(record) | python | wandb/sdk/interface/router_queue.py | 42 | 44 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,268 | __init__ | def __init__(self, fn: Any, xid: str) -> None:
super().__init__()
self._fn = fn
self._xid = xid | python | wandb/sdk/interface/message_future_poll.py | 22 | 25 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,269 | get | def get(self, timeout: Optional[int] = None) -> Optional[pb.Result]:
self._poll(timeout=timeout)
if self._object_ready.is_set():
return self._object
return None | python | wandb/sdk/interface/message_future_poll.py | 27 | 31 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,270 | _poll | def _poll(self, timeout: Optional[int] = None) -> None:
if self._object_ready.is_set():
return
done = False
start_time = time.time()
sleep_time = 0.5
while not done:
result = self._fn(xid=self._xid)
if result:
self._set_object(result)
done = True
continue
now_time = time.time()
if timeout and start_time - now_time > timeout:
done = True
continue
time.sleep(sleep_time)
sleep_time = min(sleep_time * 2, 5) | python | wandb/sdk/interface/message_future_poll.py | 33 | 50 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,271 | __init__ | def __init__(self):
self.update = []
self.remove = [] | python | wandb/sdk/interface/summary_record.py | 16 | 18 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,272 | __str__ | def __str__(self):
s = "SummaryRecord:\n Update:\n "
s += "\n ".join([str(item) for item in self.update])
s += "\n Remove:\n "
s += "\n ".join([str(item) for item in self.remove])
s += "\n"
return s | python | wandb/sdk/interface/summary_record.py | 20 | 26 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,273 | _add_next_parent | def _add_next_parent(self, parent_key):
with_next_parent = SummaryRecord()
with_next_parent.update = [
item._add_next_parent(parent_key) for item in self.update
]
with_next_parent.remove = [
item._add_next_parent(parent_key) for item in self.remove
]
return with_next_parent | python | wandb/sdk/interface/summary_record.py | 30 | 39 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,274 | __init__ | def __init__(self):
self.key = tuple()
self.value = None | python | wandb/sdk/interface/summary_record.py | 48 | 50 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,275 | __str__ | def __str__(self):
return "SummaryItem: key: " + str(self.key) + " value: " + str(self.value) | python | wandb/sdk/interface/summary_record.py | 52 | 53 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,276 | _add_next_parent | def _add_next_parent(self, parent_key):
with_next_parent = SummaryItem()
key = self.key
if not isinstance(key, tuple):
key = (key,)
with_next_parent.key = (parent_key,) + self.key
with_next_parent.value = self.value
return with_next_parent | python | wandb/sdk/interface/summary_record.py | 57 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,277 | file_policy_to_enum | def file_policy_to_enum(policy: "PolicyName") -> "pb.FilesItem.PolicyType.V":
if policy == "now":
enum = pb.FilesItem.PolicyType.NOW
elif policy == "end":
enum = pb.FilesItem.PolicyType.END
elif policy == "live":
enum = pb.FilesItem.PolicyType.LIVE
return enum | python | wandb/sdk/interface/interface.py | 59 | 66 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,278 | file_enum_to_policy | def file_enum_to_policy(enum: "pb.FilesItem.PolicyType.V") -> "PolicyName":
if enum == pb.FilesItem.PolicyType.NOW:
policy: PolicyName = "now"
elif enum == pb.FilesItem.PolicyType.END:
policy = "end"
elif enum == pb.FilesItem.PolicyType.LIVE:
policy = "live"
return policy | python | wandb/sdk/interface/interface.py | 69 | 76 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,279 | __init__ | def __init__(self) -> None:
self._run = None
self._drop = False | python | wandb/sdk/interface/interface.py | 83 | 85 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,280 | _hack_set_run | def _hack_set_run(self, run: "Run") -> None:
self._run = run
current_pid = os.getpid()
self._run._set_iface_pid(current_pid) | python | wandb/sdk/interface/interface.py | 87 | 90 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,281 | publish_header | def publish_header(self) -> None:
header = pb.HeaderRecord()
self._publish_header(header) | python | wandb/sdk/interface/interface.py | 92 | 94 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,282 | _publish_header | def _publish_header(self, header: pb.HeaderRecord) -> None:
raise NotImplementedError | python | wandb/sdk/interface/interface.py | 97 | 98 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,283 | communicate_check_version | def communicate_check_version(
self, current_version: Optional[str] = None
) -> Optional[pb.CheckVersionResponse]:
check_version = pb.CheckVersionRequest()
if current_version:
check_version.current_version = current_version
ret = self._communicate_check_version(check_version)
return ret | python | wandb/sdk/interface/interface.py | 100 | 107 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,284 | _communicate_check_version | def _communicate_check_version(
self, current_version: pb.CheckVersionRequest
) -> Optional[pb.CheckVersionResponse]:
raise NotImplementedError | python | wandb/sdk/interface/interface.py | 110 | 113 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,285 | communicate_status | def communicate_status(self) -> Optional[pb.StatusResponse]:
status = pb.StatusRequest()
resp = self._communicate_status(status)
return resp | python | wandb/sdk/interface/interface.py | 115 | 118 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,286 | _communicate_status | def _communicate_status(
self, status: pb.StatusRequest
) -> Optional[pb.StatusResponse]:
raise NotImplementedError | python | wandb/sdk/interface/interface.py | 121 | 124 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,287 | communicate_stop_status | def communicate_stop_status(self) -> Optional[pb.StopStatusResponse]:
status = pb.StopStatusRequest()
resp = self._communicate_stop_status(status)
return resp | python | wandb/sdk/interface/interface.py | 126 | 129 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,288 | _communicate_stop_status | def _communicate_stop_status(
self, status: pb.StopStatusRequest
) -> Optional[pb.StopStatusResponse]:
raise NotImplementedError | python | wandb/sdk/interface/interface.py | 132 | 135 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,289 | communicate_network_status | def communicate_network_status(self) -> Optional[pb.NetworkStatusResponse]:
status = pb.NetworkStatusRequest()
resp = self._communicate_network_status(status)
return resp | python | wandb/sdk/interface/interface.py | 137 | 140 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,290 | _communicate_network_status | def _communicate_network_status(
self, status: pb.NetworkStatusRequest
) -> Optional[pb.NetworkStatusResponse]:
raise NotImplementedError | python | wandb/sdk/interface/interface.py | 143 | 146 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,291 | _make_config | def _make_config(
self,
data: Optional[dict] = None,
key: Optional[Union[Tuple[str, ...], str]] = None,
val: Optional[Any] = None,
obj: Optional[pb.ConfigRecord] = None,
) -> pb.ConfigRecord:
config = obj or pb.ConfigRecord()
if data:
for k, v in data.items():
update = config.update.add()
update.key = k
update.value_json = json_dumps_safer(json_friendly(v)[0])
if key:
update = config.update.add()
if isinstance(key, tuple):
for k in key:
update.nested_key.append(k)
else:
update.key = key
update.value_json = json_dumps_safer(json_friendly(val)[0])
return config | python | wandb/sdk/interface/interface.py | 148 | 169 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,292 | _make_run | def _make_run(self, run: "Run") -> pb.RunRecord:
proto_run = pb.RunRecord()
run._make_proto_run(proto_run)
if run._settings.host:
proto_run.host = run._settings.host
if run._config is not None:
config_dict = run._config._as_dict() # type: ignore
self._make_config(data=config_dict, obj=proto_run.config)
if run._telemetry_obj:
proto_run.telemetry.MergeFrom(run._telemetry_obj)
return proto_run | python | wandb/sdk/interface/interface.py | 171 | 181 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,293 | publish_run | def publish_run(self, run: "pb.RunRecord") -> None:
self._publish_run(run) | python | wandb/sdk/interface/interface.py | 183 | 184 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,294 | _publish_run | def _publish_run(self, run: pb.RunRecord) -> None:
raise NotImplementedError | python | wandb/sdk/interface/interface.py | 187 | 188 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,295 | publish_cancel | def publish_cancel(self, cancel_slot: str) -> None:
cancel = pb.CancelRequest(cancel_slot=cancel_slot)
self._publish_cancel(cancel) | python | wandb/sdk/interface/interface.py | 190 | 192 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,296 | _publish_cancel | def _publish_cancel(self, cancel: pb.CancelRequest) -> None:
raise NotImplementedError | python | wandb/sdk/interface/interface.py | 195 | 196 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,297 | publish_config | def publish_config(
self,
data: Optional[dict] = None,
key: Optional[Union[Tuple[str, ...], str]] = None,
val: Optional[Any] = None,
) -> None:
cfg = self._make_config(data=data, key=key, val=val)
self._publish_config(cfg) | python | wandb/sdk/interface/interface.py | 198 | 206 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,298 | _publish_config | def _publish_config(self, cfg: pb.ConfigRecord) -> None:
raise NotImplementedError | python | wandb/sdk/interface/interface.py | 209 | 210 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,299 | _publish_metric | def _publish_metric(self, metric: pb.MetricRecord) -> None:
raise NotImplementedError | python | wandb/sdk/interface/interface.py | 213 | 214 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
3,300 | communicate_attach | def communicate_attach(self, attach_id: str) -> Optional[pb.AttachResponse]:
attach = pb.AttachRequest(attach_id=attach_id)
resp = self._communicate_attach(attach)
return resp | python | wandb/sdk/interface/interface.py | 216 | 219 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.