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
1,001
_parse_entity_project_item
def _parse_entity_project_item(path: str) -> tuple: """Parse paths with the following formats: {item}, {project}/{item}, & {entity}/{project}/{item}. Args: path: `str`, input path; must be between 0 and 3 in length. Returns: tuple of length 3 - (item, project, entity) Example: ...
python
wandb/util.py
1,631
1,654
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,002
_resolve_aliases
def _resolve_aliases(aliases: Optional[Union[str, Iterable[str]]]) -> List[str]: """Add the 'latest' alias and ensure that all aliases are unique. Takes in `aliases` which can be None, str, or List[str] and returns List[str]. Ensures that "latest" is always present in the returned list. Args: ...
python
wandb/util.py
1,657
1,687
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,003
_is_artifact_object
def _is_artifact_object(v: Any) -> bool: return isinstance(v, wandb.Artifact) or isinstance(v, wandb.apis.public.Artifact)
python
wandb/util.py
1,690
1,691
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,004
_is_artifact_string
def _is_artifact_string(v: Any) -> bool: return isinstance(v, str) and v.startswith("wandb-artifact://")
python
wandb/util.py
1,694
1,695
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,005
_is_artifact_version_weave_dict
def _is_artifact_version_weave_dict(v: Any) -> bool: return isinstance(v, dict) and v.get("_type") == "artifactVersion"
python
wandb/util.py
1,698
1,699
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,006
_is_artifact_representation
def _is_artifact_representation(v: Any) -> bool: return ( _is_artifact_object(v) or _is_artifact_string(v) or _is_artifact_version_weave_dict(v) )
python
wandb/util.py
1,702
1,707
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,007
parse_artifact_string
def parse_artifact_string(v: str) -> Tuple[str, Optional[str], bool]: if not v.startswith("wandb-artifact://"): raise ValueError(f"Invalid artifact string: {v}") parsed_v = v[len("wandb-artifact://") :] base_uri = None url_info = urllib.parse.urlparse(parsed_v) if url_info.scheme != "": ...
python
wandb/util.py
1,710
1,734
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,008
_get_max_cli_version
def _get_max_cli_version() -> Union[str, None]: max_cli_version = wandb.api.max_cli_version() return str(max_cli_version) if max_cli_version is not None else None
python
wandb/util.py
1,737
1,739
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,009
_is_offline
def _is_offline() -> bool: return ( # type: ignore[no-any-return] wandb.run is not None and wandb.run.settings._offline ) or wandb.setup().settings._offline
python
wandb/util.py
1,742
1,745
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,010
ensure_text
def ensure_text( string: Union[str, bytes], encoding: str = "utf-8", errors: str = "strict" ) -> str: """Coerce s to str.""" if isinstance(string, bytes): return string.decode(encoding, errors) elif isinstance(string, str): return string else: raise TypeError(f"not expecting ...
python
wandb/util.py
1,748
1,757
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,011
make_artifact_name_safe
def make_artifact_name_safe(name: str) -> str: """Make an artifact name safe for use in artifacts.""" # artifact names may only contain alphanumeric characters, dashes, underscores, and dots. cleaned = re.sub(r"[^a-zA-Z0-9_\-.]", "_", name) if len(cleaned) <= 128: return cleaned # truncate w...
python
wandb/util.py
1,760
1,767
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,012
make_docker_image_name_safe
def make_docker_image_name_safe(name: str) -> str: """Make a docker image name safe for use in artifacts.""" safe_chars = RE_DOCKER_IMAGE_NAME_CHARS.sub("__", name.lower()) deduped = RE_DOCKER_IMAGE_NAME_SEPARATOR_REPEAT.sub("__", safe_chars) trimmed_start = RE_DOCKER_IMAGE_NAME_SEPARATOR_START.sub("", ...
python
wandb/util.py
1,770
1,776
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,013
merge_dicts
def merge_dicts(source: Dict[str, Any], destination: Dict[str, Any]) -> Dict[str, Any]: """Recursively merge two dictionaries.""" for key, value in source.items(): if isinstance(value, dict): # get node or create one node = destination.setdefault(key, {}) merge_dicts(...
python
wandb/util.py
1,779
1,794
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,014
_set_internal_process
def _set_internal_process(disable=False): global _IS_INTERNAL_PROCESS if _IS_INTERNAL_PROCESS is None: return if disable: _IS_INTERNAL_PROCESS = None return _IS_INTERNAL_PROCESS = True
python
wandb/__init__.py
92
99
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,015
_assert_is_internal_process
def _assert_is_internal_process(): if _IS_INTERNAL_PROCESS is None: return assert _IS_INTERNAL_PROCESS
python
wandb/__init__.py
102
105
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,016
_assert_is_user_process
def _assert_is_user_process(): if _IS_INTERNAL_PROCESS is None: return assert not _IS_INTERNAL_PROCESS
python
wandb/__init__.py
108
111
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,017
ensure_configured
def ensure_configured(): global api api = InternalApi()
python
wandb/__init__.py
175
177
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,018
set_trace
def set_trace(): import pdb # TODO: support other debuggers # frame = sys._getframe().f_back pdb.set_trace() # TODO: pass the parent stack...
python
wandb/__init__.py
180
184
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,019
load_ipython_extension
def load_ipython_extension(ipython): ipython.register_magics(wandb.jupyter.WandBMagics)
python
wandb/__init__.py
187
188
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,020
set_table
def set_table(self, table): self._table = table
python
wandb/data_types.py
83
84
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,021
set_table
def set_table(self, table, col_name): assert col_name in table.columns self._table = table self._col_name = col_name
python
wandb/data_types.py
88
91
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,022
get_row
def get_row(self): row = {} if self._table: row = { c: self._table.data[self][i] for i, c in enumerate(self._table.columns) } return row
python
wandb/data_types.py
95
102
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,023
_json_helper
def _json_helper(val, artifact): if isinstance(val, WBValue): return val.to_json(artifact) elif val.__class__ == dict: res = {} for key in val: res[key] = _json_helper(val[key], artifact) return res if hasattr(val, "tolist"): py_val = val.tolist() ...
python
wandb/data_types.py
105
147
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,024
__init__
def __init__( self, columns=None, data=None, rows=None, dataframe=None, dtype=None, optional=True, allow_mixed_types=False, ): """Initialize a Table object. Rows is kept for legacy reasons, we use data to mimic the Pandas api. ...
python
wandb/data_types.py
250
293
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,025
_assert_valid_columns
def _assert_valid_columns(columns): valid_col_types = [str, int] assert type(columns) is list, "columns argument expects a `list` object" assert len(columns) == 0 or all( [type(col) in valid_col_types for col in columns] ), "columns argument expects list of strings or ints"
python
wandb/data_types.py
296
301
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,026
_init_from_list
def _init_from_list(self, data, columns, optional=True, dtype=None): assert type(data) is list, "data argument expects a `list` object" self.data = [] self._assert_valid_columns(columns) self.columns = columns self._make_column_types(dtype, optional) for row in data: ...
python
wandb/data_types.py
303
310
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,027
_init_from_ndarray
def _init_from_ndarray(self, ndarray, columns, optional=True, dtype=None): assert util.is_numpy_array( ndarray ), "ndarray argument expects a `numpy.ndarray` object" self.data = [] self._assert_valid_columns(columns) self.columns = columns self._make_column_ty...
python
wandb/data_types.py
312
321
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,028
_init_from_dataframe
def _init_from_dataframe(self, dataframe, columns, optional=True, dtype=None): assert util.is_pandas_data_frame( dataframe ), "dataframe argument expects a `pandas.core.frame.DataFrame` object" self.data = [] columns = list(dataframe.columns) self._assert_valid_column...
python
wandb/data_types.py
323
333
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,029
_make_column_types
def _make_column_types(self, dtype=None, optional=True): if dtype is None: dtype = _dtypes.UnknownType() if optional.__class__ != list: optional = [optional for _ in range(len(self.columns))] if dtype.__class__ != list: dtype = [dtype for _ in range(len(self...
python
wandb/data_types.py
335
347
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,030
cast
def cast(self, col_name, dtype, optional=False): """Cast a column to a specific type. Arguments: col_name: (str) - name of the column to cast dtype: (class, wandb.wandb_sdk.interface._dtypes.Type, any) - the target dtype. Can be one of normal python class, intern...
python
wandb/data_types.py
349
403
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,031
__ne__
def __ne__(self, other): return not self.__eq__(other)
python
wandb/data_types.py
405
406
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,032
_eq_debug
def _eq_debug(self, other, should_assert=False): eq = isinstance(other, Table) assert not should_assert or eq, "Found type {}, expected {}".format( other.__class__, Table ) eq = eq and len(self.data) == len(other.data) assert not should_assert or eq, "Found {} rows, e...
python
wandb/data_types.py
408
445
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,033
__eq__
def __eq__(self, other): return self._eq_debug(other)
python
wandb/data_types.py
447
448
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,034
add_row
def add_row(self, *row): """Deprecated: use add_data instead.""" logging.warning("add_row is deprecated, use add_data") self.add_data(*row)
python
wandb/data_types.py
450
453
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,035
add_data
def add_data(self, *data): """Add a row of data to the table. Argument length should match column length. """ if len(data) != len(self.columns): raise ValueError( "This table expects {} columns: {}, found {}".format( len(self.columns), sel...
python
wandb/data_types.py
455
488
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,036
_get_updated_result_type
def _get_updated_result_type(self, row): """Return an updated result type based on incoming row. Raises: TypeError: if the assignment is invalid. """ incoming_row_dict = { col_key: row[ndx] for ndx, col_key in enumerate(self.columns) } current_typ...
python
wandb/data_types.py
490
507
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,037
_to_table_json
def _to_table_json(self, max_rows=None, warn=True): # separate this method for easier testing if max_rows is None: max_rows = Table.MAX_ROWS n_rows = len(self.data) if n_rows > max_rows and warn: if wandb.run and ( wandb.run.settings.table_raise_on...
python
wandb/data_types.py
509
526
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,038
bind_to_run
def bind_to_run(self, *args, **kwargs): # We set `warn=False` since Tables will now always be logged to both # files and artifacts. The file limit will never practically matter and # this code path will be ultimately removed. The 10k limit warning confuses # users given that we publicly ...
python
wandb/data_types.py
528
539
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,039
get_media_subdir
def get_media_subdir(cls): return os.path.join("media", "table")
python
wandb/data_types.py
542
543
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,040
from_json
def from_json(cls, json_obj, source_artifact): data = [] column_types = None np_deserialized_columns = {} timestamp_column_indices = set() if json_obj.get("column_types") is not None: column_types = _dtypes.TypeRegistry.type_from_dict( json_obj["column...
python
wandb/data_types.py
546
619
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,041
to_json
def to_json(self, run_or_artifact): json_dict = super().to_json(run_or_artifact) if isinstance(run_or_artifact, wandb.wandb_sdk.wandb_run.Run): json_dict.update( { "_type": "table-file", "ncols": len(self.columns), ...
python
wandb/data_types.py
621
704
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,042
iterrows
def iterrows(self): """Iterate over rows as (ndx, row). Yields: ------ index : int The index of the row. Using this value in other WandB tables will automatically build a relationship between the tables row : List[any] The data of the row. ...
python
wandb/data_types.py
706
720
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,043
set_pk
def set_pk(self, col_name): # TODO: Docs assert col_name in self.columns self.cast(col_name, _PrimaryKeyType())
python
wandb/data_types.py
722
725
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,044
set_fk
def set_fk(self, col_name, table, table_col): # TODO: Docs assert col_name in self.columns assert col_name != self._pk_col self.cast(col_name, _ForeignKeyType(table, table_col))
python
wandb/data_types.py
727
731
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,045
_update_keys
def _update_keys(self, force_last=False): """Update the known key-like columns based on the current column types. If the state has been updated since the last update, we wrap the data appropriately in the Key classes. Arguments: force_last: (bool) Determines wrapping the la...
python
wandb/data_types.py
733
778
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,046
_apply_key_updates
def _apply_key_updates(self, only_last=False): """Appropriately wrap the underlying data in special key classes. Arguments: only_last: only apply the updates to the last row (used for performance when the caller knows that the only new data is the last row and no updates were ...
python
wandb/data_types.py
780
827
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,047
update_row
def update_row(row_ndx): for fk_col in self._fk_cols: col_ndx = self.columns.index(fk_col) # Wrap the Foreign Keys if isinstance(c_types[fk_col], _ForeignKeyType) and not isinstance( self.data[row_ndx][col_ndx], _TableKey )...
python
wandb/data_types.py
792
821
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,048
add_column
def add_column(self, name, data, optional=False): """Add a column of data to the table. Arguments: name: (str) - the unique name of the column data: (list | np.array) - a column of homogenous data optional: (bool) - if null-like values are permitted """ ...
python
wandb/data_types.py
829
868
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,049
get_column
def get_column(self, name, convert_to=None): """Retrieve a column of data from the table. Arguments: name: (str) - the name of the column convert_to: (str, optional) - "numpy": will convert the underlying data to numpy object """ assert name in se...
python
wandb/data_types.py
870
893
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,050
get_index
def get_index(self): """Return an array of row indexes for use in other tables to create links.""" ndxs = [] for ndx in range(len(self.data)): index = _TableIndex(ndx) index.set_table(self) ndxs.append(index) return ndxs
python
wandb/data_types.py
895
902
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,051
index_ref
def index_ref(self, index): """Get a reference to a particular row index in the table.""" assert index < len(self.data) _index = _TableIndex(index) _index.set_table(self) return _index
python
wandb/data_types.py
904
909
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,052
add_computed_columns
def add_computed_columns(self, fn): """Add one or more computed columns based on existing data. Args: fn: A function which accepts one or two parameters, ndx (int) and row (dict), which is expected to return a dict representing new columns for that row, keyed ...
python
wandb/data_types.py
911
933
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,053
__init__
def __init__(self, entry, source_artifact): self.entry = entry self.source_artifact = source_artifact self._part = None
python
wandb/data_types.py
939
942
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,054
get_part
def get_part(self): if self._part is None: self._part = self.source_artifact.get(self.entry.path) return self._part
python
wandb/data_types.py
944
947
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,055
free
def free(self): self._part = None
python
wandb/data_types.py
949
950
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,056
__init__
def __init__(self, parts_path): """Initialize a PartitionedTable. Args: parts_path (str): path to a directory of tables in the artifact. """ super().__init__() self.parts_path = parts_path self._loaded_part_entries = {}
python
wandb/data_types.py
961
969
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,057
to_json
def to_json(self, artifact_or_run): json_obj = { "_type": PartitionedTable._log_type, } if isinstance(artifact_or_run, wandb.wandb_sdk.wandb_run.Run): artifact_entry_url = self._get_artifact_entry_ref_url() if artifact_entry_url is None: raise ...
python
wandb/data_types.py
971
984
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,058
from_json
def from_json(cls, json_obj, source_artifact): instance = cls(json_obj["parts_path"]) entries = source_artifact.manifest.get_entries_in_directory( json_obj["parts_path"] ) for entry in entries: instance._add_part_entry(entry, source_artifact) return instan...
python
wandb/data_types.py
987
994
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,059
iterrows
def iterrows(self): """Iterate over rows as (ndx, row). Yields: ------ index : int The index of the row. row : List[any] The data of the row. """ columns = None ndx = 0 for entry_path in self._loaded_part_entries: ...
python
wandb/data_types.py
996
1,022
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,060
_add_part_entry
def _add_part_entry(self, entry, source_artifact): self._loaded_part_entries[entry.path] = _PartitionTablePartEntry( entry, source_artifact )
python
wandb/data_types.py
1,024
1,027
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,061
__ne__
def __ne__(self, other): return not self.__eq__(other)
python
wandb/data_types.py
1,029
1,030
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,062
__eq__
def __eq__(self, other): return isinstance(other, self.__class__) and self.parts_path == other.parts_path
python
wandb/data_types.py
1,032
1,033
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,063
bind_to_run
def bind_to_run(self, *args, **kwargs): raise ValueError("PartitionedTables cannot be bound to runs")
python
wandb/data_types.py
1,035
1,036
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,064
__init__
def __init__(self, data_or_path, sample_rate=None, caption=None): """Accept a path to an audio file or a numpy array of audio data.""" super().__init__() self._duration = None self._sample_rate = sample_rate self._caption = caption if isinstance(data_or_path, str): ...
python
wandb/data_types.py
1,052
1,081
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,065
get_media_subdir
def get_media_subdir(cls): return os.path.join("media", "audio")
python
wandb/data_types.py
1,084
1,085
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,066
from_json
def from_json(cls, json_obj, source_artifact): return cls( source_artifact.get_path(json_obj["path"]).download(), caption=json_obj["caption"], )
python
wandb/data_types.py
1,088
1,092
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,067
bind_to_run
def bind_to_run( self, run, key, step, id_=None, ignore_copy_err: Optional[bool] = None ): if self.path_is_reference(self._path): raise ValueError( "Audio media created by a reference to external storage cannot currently be added to a run" ) return su...
python
wandb/data_types.py
1,094
1,102
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,068
to_json
def to_json(self, run): json_dict = super().to_json(run) json_dict.update( { "_type": self._log_type, "caption": self._caption, } ) return json_dict
python
wandb/data_types.py
1,104
1,112
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,069
seq_to_json
def seq_to_json(cls, seq, run, key, step): audio_list = list(seq) util.get_module( "soundfile", required="wandb.Audio requires the soundfile package. To get it, run: pip install soundfile", ) base_path = os.path.join(run.dir, "media", "audio") filesystem....
python
wandb/data_types.py
1,115
1,139
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,070
durations
def durations(cls, audio_list): return [a._duration for a in audio_list]
python
wandb/data_types.py
1,142
1,143
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,071
sample_rates
def sample_rates(cls, audio_list): return [a._sample_rate for a in audio_list]
python
wandb/data_types.py
1,146
1,147
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,072
captions
def captions(cls, audio_list): captions = [a._caption for a in audio_list] if all(c is None for c in captions): return False else: return ["" if c is None else c for c in captions]
python
wandb/data_types.py
1,150
1,155
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,073
resolve_ref
def resolve_ref(self): if self.path_is_reference(self._path): # this object was already created using a ref: return self._path source_artifact = self._artifact_source.artifact resolved_name = source_artifact._local_path_to_name(self._path) if resolved_name is not...
python
wandb/data_types.py
1,157
1,169
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,074
__eq__
def __eq__(self, other): if self.path_is_reference(self._path) or self.path_is_reference(other._path): # one or more of these objects is an unresolved reference -- we'll compare # their reference paths instead of their SHAs: return ( self.resolve_ref() == othe...
python
wandb/data_types.py
1,171
1,180
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,075
__ne__
def __ne__(self, other): return not self.__eq__(other)
python
wandb/data_types.py
1,182
1,183
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,076
__init__
def __init__(self, table1, table2, join_key): super().__init__() if not isinstance(join_key, str) and ( not isinstance(join_key, list) or len(join_key) != 2 ): raise ValueError( "JoinedTable join_key should be a string or a list of two strings" ...
python
wandb/data_types.py
1,200
1,222
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,077
from_json
def from_json(cls, json_obj, source_artifact): t1 = source_artifact.get(json_obj["table1"]) if t1 is None: t1 = json_obj["table1"] t2 = source_artifact.get(json_obj["table2"]) if t2 is None: t2 = json_obj["table2"] return cls( t1, ...
python
wandb/data_types.py
1,225
1,238
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,078
_validate_table_input
def _validate_table_input(table): """Helper method to validate that the table input is one of the 3 supported types.""" return ( (type(table) == str and table.endswith(".table.json")) or isinstance(table, Table) or isinstance(table, PartitionedTable) or (h...
python
wandb/data_types.py
1,241
1,248
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,079
_ensure_table_in_artifact
def _ensure_table_in_artifact(self, table, artifact, table_ndx): """Helper method to add the table to the incoming artifact. Returns the path.""" if isinstance(table, Table) or isinstance(table, PartitionedTable): table_name = f"t{table_ndx}_{str(id(self))}" if ( ...
python
wandb/data_types.py
1,250
1,276
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,080
to_json
def to_json(self, artifact_or_run): json_obj = { "_type": JoinedTable._log_type, } if isinstance(artifact_or_run, wandb.wandb_sdk.wandb_run.Run): artifact_entry_url = self._get_artifact_entry_ref_url() if artifact_entry_url is None: raise Value...
python
wandb/data_types.py
1,278
1,299
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,081
__ne__
def __ne__(self, other): return not self.__eq__(other)
python
wandb/data_types.py
1,301
1,302
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,082
_eq_debug
def _eq_debug(self, other, should_assert=False): eq = isinstance(other, JoinedTable) assert not should_assert or eq, "Found type {}, expected {}".format( other.__class__, JoinedTable ) eq = eq and self._join_key == other._join_key assert not should_assert or eq, "Foun...
python
wandb/data_types.py
1,304
1,315
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,083
__eq__
def __eq__(self, other): return self._eq_debug(other, False)
python
wandb/data_types.py
1,317
1,318
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,084
bind_to_run
def bind_to_run(self, *args, **kwargs): raise ValueError("JoinedTables cannot be bound to runs")
python
wandb/data_types.py
1,320
1,321
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,085
__init__
def __init__(self, data_or_path): super().__init__() bokeh = util.get_module("bokeh", required=True) if isinstance(data_or_path, str) and os.path.exists(data_or_path): with open(data_or_path) as file: b_json = json.load(file) self.b_obj = bokeh.document.Do...
python
wandb/data_types.py
1,333
1,358
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,086
get_media_subdir
def get_media_subdir(self): return os.path.join("media", "bokeh")
python
wandb/data_types.py
1,360
1,361
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,087
to_json
def to_json(self, run): # TODO: (tss) this is getting redundant for all the media objects. We can probably # pull this into Media#to_json and remove this type override for all the media types. # There are only a few cases where the type is different between artifacts and runs. json_dict ...
python
wandb/data_types.py
1,363
1,369
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,088
from_json
def from_json(cls, json_obj, source_artifact): return cls(source_artifact.get_path(json_obj["path"]).download())
python
wandb/data_types.py
1,372
1,373
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,089
_nest
def _nest(thing): # Use tensorflows nest function if available, otherwise just wrap object in an array""" tfutil = util.get_module("tensorflow.python.util") if tfutil: return tfutil.nest.flatten(thing) else: return [thing]
python
wandb/data_types.py
1,376
1,383
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,090
__init__
def __init__(self, format="keras"): super().__init__() # LB: TODO: I think we should factor criterion and criterion_passed out self.format = format self.nodes = [] self.nodes_by_id = {} self.edges = [] self.loaded = False self.criterion = None self...
python
wandb/data_types.py
1,410
1,420
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,091
_to_graph_json
def _to_graph_json(self, run=None): # Needs to be its own function for tests return { "format": self.format, "nodes": [node.to_json() for node in self.nodes], "edges": [edge.to_json() for edge in self.edges], }
python
wandb/data_types.py
1,422
1,428
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,092
bind_to_run
def bind_to_run(self, *args, **kwargs): data = self._to_graph_json() tmp_path = os.path.join(MEDIA_TMP.name, runid.generate_id() + ".graph.json") data = _numpy_arrays_to_lists(data) with codecs.open(tmp_path, "w", encoding="utf-8") as fp: util.json_dump_safer(data, fp) ...
python
wandb/data_types.py
1,430
1,439
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,093
get_media_subdir
def get_media_subdir(cls): return os.path.join("media", "graph")
python
wandb/data_types.py
1,442
1,443
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,094
to_json
def to_json(self, run): json_dict = super().to_json(run) json_dict["_type"] = self._log_type return json_dict
python
wandb/data_types.py
1,445
1,448
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,095
__getitem__
def __getitem__(self, nid): return self.nodes_by_id[nid]
python
wandb/data_types.py
1,450
1,451
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,096
pprint
def pprint(self): for edge in self.edges: pprint.pprint(edge.attributes) for node in self.nodes: pprint.pprint(node.attributes)
python
wandb/data_types.py
1,453
1,457
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,097
add_node
def add_node(self, node=None, **node_kwargs): if node is None: node = Node(**node_kwargs) elif node_kwargs: raise ValueError( "Only pass one of either node ({node}) or other keyword arguments ({node_kwargs})".format( node=node, node_kwargs=node...
python
wandb/data_types.py
1,459
1,471
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,098
add_edge
def add_edge(self, from_node, to_node): edge = Edge(from_node, to_node) self.edges.append(edge) return edge
python
wandb/data_types.py
1,473
1,477
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,099
from_keras
def from_keras(cls, model): graph = cls() # Shamelessly copied (then modified) from keras/keras/utils/layer_utils.py sequential_like = cls._is_sequential(model) relevant_nodes = None if not sequential_like: relevant_nodes = [] for v in model._nodes_by_dep...
python
wandb/data_types.py
1,480
1,508
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
1,100
_is_sequential
def _is_sequential(cls, model): sequential_like = True if ( model.__class__.__name__ != "Sequential" and hasattr(model, "_is_graph_network") and model._is_graph_network ): nodes_by_depth = model._nodes_by_depth.values() nodes = [] ...
python
wandb/data_types.py
1,511
1,547
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }