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,501 | _sampled_history | def _sampled_history(self, keys, x_axis="_step", samples=500):
spec = {"keys": [x_axis] + keys, "samples": samples}
query = gql(
"""
query RunSampledHistory($project: String!, $entity: String!, $name: String!, $specs: [JSONString!]!) {
project(name: $project, entityName: $entity) {
run(name: $name) { sampledHistory(specs: $specs) }
}
}
"""
)
response = self._exec(query, specs=[json.dumps(spec)])
# sampledHistory returns one list per spec, we only send one spec
return response["project"]["run"]["sampledHistory"][0] | python | wandb/apis/public.py | 1,964 | 1,978 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,502 | _full_history | def _full_history(self, samples=500, stream="default"):
node = "history" if stream == "default" else "events"
query = gql(
"""
query RunFullHistory($project: String!, $entity: String!, $name: String!, $samples: Int) {
project(name: $project, entityName: $entity) {
run(name: $name) { %s(samples: $samples) }
}
}
"""
% node
)
response = self._exec(query, samples=samples)
return [json.loads(line) for line in response["project"]["run"][node]] | python | wandb/apis/public.py | 1,980 | 1,994 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,503 | files | def files(self, names=None, per_page=50):
"""Return a file path for each file named.
Arguments:
names (list): names of the requested files, if empty returns all files
per_page (int): number of results per page.
Returns:
A `Files` object, which is an iterator over `File` objects.
"""
return Files(self.client, self, names or [], per_page) | python | wandb/apis/public.py | 1,997 | 2,007 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,504 | file | def file(self, name):
"""Return the path of a file with a given name in the artifact.
Arguments:
name (str): name of requested file.
Returns:
A `File` matching the name argument.
"""
return Files(self.client, self, [name])[0] | python | wandb/apis/public.py | 2,010 | 2,019 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,505 | upload_file | def upload_file(self, path, root="."):
"""Upload a file.
Arguments:
path (str): name of file to upload.
root (str): the root path to save the file relative to. i.e.
If you want to have the file saved in the run as "my_dir/file.txt"
and you're currently in "my_dir" you would set root to "../".
Returns:
A `File` matching the name argument.
"""
api = InternalApi(
default_settings={"entity": self.entity, "project": self.project},
retry_timedelta=RETRY_TIMEDELTA,
)
api.set_current_run_id(self.id)
root = os.path.abspath(root)
name = os.path.relpath(path, root)
with open(os.path.join(root, name), "rb") as f:
api.push({util.to_forward_slash_path(name): f})
return Files(self.client, self, [name])[0] | python | wandb/apis/public.py | 2,022 | 2,043 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,506 | history | def history(
self, samples=500, keys=None, x_axis="_step", pandas=True, stream="default"
):
"""Return sampled history metrics for a run.
This is simpler and faster if you are ok with the history records being sampled.
Arguments:
samples : (int, optional) The number of samples to return
pandas : (bool, optional) Return a pandas dataframe
keys : (list, optional) Only return metrics for specific keys
x_axis : (str, optional) Use this metric as the xAxis defaults to _step
stream : (str, optional) "default" for metrics, "system" for machine metrics
Returns:
pandas.DataFrame: If pandas=True returns a `pandas.DataFrame` of history
metrics.
list of dicts: If pandas=False returns a list of dicts of history metrics.
"""
if keys is not None and not isinstance(keys, list):
wandb.termerror("keys must be specified in a list")
return []
if keys is not None and len(keys) > 0 and not isinstance(keys[0], str):
wandb.termerror("keys argument must be a list of strings")
return []
if keys and stream != "default":
wandb.termerror("stream must be default when specifying keys")
return []
elif keys:
lines = self._sampled_history(keys=keys, x_axis=x_axis, samples=samples)
else:
lines = self._full_history(samples=samples, stream=stream)
if pandas:
pandas = util.get_module("pandas")
if pandas:
lines = pandas.DataFrame.from_records(lines)
else:
print("Unable to load pandas, call history with pandas=False")
return lines | python | wandb/apis/public.py | 2,046 | 2,085 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,507 | scan_history | def scan_history(self, keys=None, page_size=1000, min_step=None, max_step=None):
"""Returns an iterable collection of all history records for a run.
Example:
Export all the loss values for an example run
```python
run = api.run("l2k2/examples-numpy-boston/i0wt6xua")
history = run.scan_history(keys=["Loss"])
losses = [row["Loss"] for row in history]
```
Arguments:
keys ([str], optional): only fetch these keys, and only fetch rows that have all of keys defined.
page_size (int, optional): size of pages to fetch from the api
Returns:
An iterable collection over history records (dict).
"""
if keys is not None and not isinstance(keys, list):
wandb.termerror("keys must be specified in a list")
return []
if keys is not None and len(keys) > 0 and not isinstance(keys[0], str):
wandb.termerror("keys argument must be a list of strings")
return []
last_step = self.lastHistoryStep
# set defaults for min/max step
if min_step is None:
min_step = 0
if max_step is None:
max_step = last_step + 1
# if the max step is past the actual last step, clamp it down
if max_step > last_step:
max_step = last_step + 1
if keys is None:
return HistoryScan(
run=self,
client=self.client,
page_size=page_size,
min_step=min_step,
max_step=max_step,
)
else:
return SampledHistoryScan(
run=self,
client=self.client,
keys=keys,
page_size=page_size,
min_step=min_step,
max_step=max_step,
) | python | wandb/apis/public.py | 2,088 | 2,140 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,508 | logged_artifacts | def logged_artifacts(self, per_page=100):
return RunArtifacts(self.client, self, mode="logged", per_page=per_page) | python | wandb/apis/public.py | 2,143 | 2,144 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,509 | used_artifacts | def used_artifacts(self, per_page=100):
return RunArtifacts(self.client, self, mode="used", per_page=per_page) | python | wandb/apis/public.py | 2,147 | 2,148 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,510 | use_artifact | def use_artifact(self, artifact, use_as=None):
"""Declare an artifact as an input to a run.
Arguments:
artifact (`Artifact`): An artifact returned from
`wandb.Api().artifact(name)`
use_as (string, optional): A string identifying
how the artifact is used in the script. Used
to easily differentiate artifacts used in a
run, when using the beta wandb launch
feature's artifact swapping functionality.
Returns:
A `Artifact` object.
"""
api = InternalApi(
default_settings={"entity": self.entity, "project": self.project},
retry_timedelta=RETRY_TIMEDELTA,
)
api.set_current_run_id(self.id)
if isinstance(artifact, Artifact):
api.use_artifact(artifact.id, use_as=use_as or artifact.name)
return artifact
elif isinstance(artifact, wandb.Artifact):
raise ValueError(
"Only existing artifacts are accepted by this api. "
"Manually create one with `wandb artifacts put`"
)
else:
raise ValueError("You must pass a wandb.Api().artifact() to use_artifact") | python | wandb/apis/public.py | 2,151 | 2,181 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,511 | log_artifact | def log_artifact(self, artifact, aliases=None):
"""Declare an artifact as output of a run.
Arguments:
artifact (`Artifact`): An artifact returned from
`wandb.Api().artifact(name)`
aliases (list, optional): Aliases to apply to this artifact
Returns:
A `Artifact` object.
"""
api = InternalApi(
default_settings={"entity": self.entity, "project": self.project},
retry_timedelta=RETRY_TIMEDELTA,
)
api.set_current_run_id(self.id)
if isinstance(artifact, Artifact):
artifact_collection_name = artifact.name.split(":")[0]
api.create_artifact(
artifact.type,
artifact_collection_name,
artifact.digest,
aliases=aliases,
)
return artifact
elif isinstance(artifact, wandb.Artifact):
raise ValueError(
"Only existing artifacts are accepted by this api. "
"Manually create one with `wandb artifacts put`"
)
else:
raise ValueError("You must pass a wandb.Api().artifact() to use_artifact") | python | wandb/apis/public.py | 2,184 | 2,215 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,512 | summary | def summary(self):
if self._summary is None:
from wandb.old.summary import HTTPSummary
# TODO: fix the outdir issue
self._summary = HTTPSummary(self, self.client, summary=self.summary_metrics)
return self._summary | python | wandb/apis/public.py | 2,218 | 2,224 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,513 | path | def path(self):
return [
urllib.parse.quote_plus(str(self.entity)),
urllib.parse.quote_plus(str(self.project)),
urllib.parse.quote_plus(str(self.id)),
] | python | wandb/apis/public.py | 2,227 | 2,232 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,514 | url | def url(self):
path = self.path
path.insert(2, "runs")
return self.client.app_url + "/".join(path) | python | wandb/apis/public.py | 2,235 | 2,238 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,515 | lastHistoryStep | def lastHistoryStep(self): # noqa: N802
query = gql(
"""
query RunHistoryKeys($project: String!, $entity: String!, $name: String!) {
project(name: $project, entityName: $entity) {
run(name: $name) { historyKeys }
}
}
"""
)
response = self._exec(query)
if (
response is None
or response.get("project") is None
or response["project"].get("run") is None
or response["project"]["run"].get("historyKeys") is None
):
return -1
history_keys = response["project"]["run"]["historyKeys"]
return history_keys["lastStep"] if "lastStep" in history_keys else -1 | python | wandb/apis/public.py | 2,241 | 2,260 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,516 | to_html | def to_html(self, height=420, hidden=False):
"""Generate HTML containing an iframe displaying this run."""
url = self.url + "?jupyter=true"
style = f"border:none;width:100%;height:{height}px;"
prefix = ""
if hidden:
style += "display:none;"
prefix = ipython.toggle_button()
return prefix + f"<iframe src={url!r} style={style!r}></iframe>" | python | wandb/apis/public.py | 2,262 | 2,270 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,517 | _repr_html_ | def _repr_html_(self) -> str:
return self.to_html() | python | wandb/apis/public.py | 2,272 | 2,273 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,518 | __repr__ | def __repr__(self):
return "<Run {} ({})>".format("/".join(self.path), self.state) | python | wandb/apis/public.py | 2,275 | 2,276 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,519 | __init__ | def __init__(
self,
client,
entity,
project,
queue_name,
run_queue_item_id,
container_job=False,
project_queue=LAUNCH_DEFAULT_PROJECT,
):
self.client = client
self._entity = entity
self._project = project
self._queue_name = queue_name
self._run_queue_item_id = run_queue_item_id
self.sweep = None
self._run = None
self.container_job = container_job
self.project_queue = project_queue | python | wandb/apis/public.py | 2,282 | 2,300 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,520 | queue_name | def queue_name(self):
return self._queue_name | python | wandb/apis/public.py | 2,303 | 2,304 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,521 | id | def id(self):
return self._run_queue_item_id | python | wandb/apis/public.py | 2,307 | 2,308 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,522 | project | def project(self):
return self._project | python | wandb/apis/public.py | 2,311 | 2,312 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,523 | entity | def entity(self):
return self._entity | python | wandb/apis/public.py | 2,315 | 2,316 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,524 | state | def state(self):
item = self._get_item()
if item:
return item["state"].lower()
raise ValueError(
f"Could not find QueuedRunItem associated with id: {self.id} on queue {self.queue_name} at itemId: {self.id}"
) | python | wandb/apis/public.py | 2,319 | 2,326 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,525 | _get_run_queue_item_legacy | def _get_run_queue_item_legacy(self) -> Dict:
query = gql(
"""
query GetRunQueueItem($projectName: String!, $entityName: String!, $runQueue: String!) {
project(name: $projectName, entityName: $entityName) {
runQueue(name:$runQueue) {
runQueueItems {
edges {
node {
id
state
associatedRunId
}
}
}
}
}
}
"""
)
variable_values = {
"projectName": self.project_queue,
"entityName": self._entity,
"runQueue": self.queue_name,
}
res = self.client.execute(query, variable_values)
for item in res["project"]["runQueue"]["runQueueItems"]["edges"]:
if str(item["node"]["id"]) == str(self.id):
return item["node"] | python | wandb/apis/public.py | 2,329 | 2,358 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,526 | _get_item | def _get_item(self):
query = gql(
"""
query GetRunQueueItem($projectName: String!, $entityName: String!, $runQueue: String!, $itemId: ID!) {
project(name: $projectName, entityName: $entityName) {
runQueue(name: $runQueue) {
runQueueItem(id: $itemId) {
id
state
associatedRunId
}
}
}
}
"""
)
variable_values = {
"projectName": self.project_queue,
"entityName": self._entity,
"runQueue": self.queue_name,
"itemId": self.id,
}
try:
res = self.client.execute(query, variable_values) # exception w/ old server
if res["project"]["runQueue"].get("runQueueItem") is not None:
return res["project"]["runQueue"]["runQueueItem"]
except Exception as e:
if "Cannot query field" not in str(e):
raise LaunchError(f"Unknown exception: {e}")
return self._get_run_queue_item_legacy() | python | wandb/apis/public.py | 2,361 | 2,391 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,527 | wait_until_finished | def wait_until_finished(self):
if not self._run:
self.wait_until_running()
self._run.wait_until_finished()
# refetch run to get updated summary
self._run.load(force=True)
return self._run | python | wandb/apis/public.py | 2,394 | 2,401 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,528 | delete | def delete(self, delete_artifacts=False):
"""Delete the given queued run from the wandb backend."""
query = gql(
"""
query fetchRunQueuesFromProject($entityName: String!, $projectName: String!, $runQueueName: String!) {
project(name: $projectName, entityName: $entityName) {
runQueue(name: $runQueueName) {
id
}
}
}
"""
)
res = self.client.execute(
query,
variable_values={
"entityName": self.entity,
"projectName": self.project_queue,
"runQueueName": self.queue_name,
},
)
if res["project"].get("runQueue") is not None:
queue_id = res["project"]["runQueue"]["id"]
mutation = gql(
"""
mutation DeleteFromRunQueue(
$queueID: ID!,
$runQueueItemId: ID!
) {
deleteFromRunQueue(input: {
queueID: $queueID
runQueueItemId: $runQueueItemId
}) {
success
clientMutationId
}
}
"""
)
self.client.execute(
mutation,
variable_values={
"queueID": queue_id,
"runQueueItemId": self._run_queue_item_id,
},
) | python | wandb/apis/public.py | 2,404 | 2,452 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,529 | wait_until_running | def wait_until_running(self):
if self._run is not None:
return self._run
if self.container_job:
raise LaunchError("Container jobs cannot be waited on")
while True:
# sleep here to hide an ugly warning
time.sleep(2)
item = self._get_item()
if item and item["associatedRunId"] is not None:
try:
self._run = Run(
self.client,
self._entity,
self.project,
item["associatedRunId"],
None,
)
self._run_id = item["associatedRunId"]
return self._run
except ValueError as e:
print(e)
elif item:
wandb.termlog("Waiting for run to start")
time.sleep(3) | python | wandb/apis/public.py | 2,455 | 2,481 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,530 | __repr__ | def __repr__(self):
return f"<QueuedRun {self.queue_name} ({self.id})" | python | wandb/apis/public.py | 2,483 | 2,484 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,531 | __init__ | def __init__(self, client, entity, project, sweep_id, attrs=None):
# TODO: Add agents / flesh this out.
super().__init__(dict(attrs or {}))
self.client = client
self._entity = entity
self.project = project
self.id = sweep_id
self.runs = []
self.load(force=not attrs) | python | wandb/apis/public.py | 2,539 | 2,548 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,532 | entity | def entity(self):
return self._entity | python | wandb/apis/public.py | 2,551 | 2,552 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,533 | username | def username(self):
wandb.termwarn("Sweep.username is deprecated. please use Sweep.entity instead.")
return self._entity | python | wandb/apis/public.py | 2,555 | 2,557 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,534 | config | def config(self):
return util.load_yaml(self._attrs["config"]) | python | wandb/apis/public.py | 2,560 | 2,561 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,535 | load | def load(self, force: bool = False):
if force or not self._attrs:
sweep = self.get(self.client, self.entity, self.project, self.id)
if sweep is None:
raise ValueError("Could not find sweep %s" % self)
self._attrs = sweep._attrs
self.runs = sweep.runs
return self._attrs | python | wandb/apis/public.py | 2,563 | 2,571 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,536 | order | def order(self):
if self._attrs.get("config") and self.config.get("metric"):
sort_order = self.config["metric"].get("goal", "minimize")
prefix = "+" if sort_order == "minimize" else "-"
return QueryGenerator.format_order_key(
prefix + self.config["metric"]["name"]
) | python | wandb/apis/public.py | 2,574 | 2,580 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,537 | best_run | def best_run(self, order=None):
"""Return the best run sorted by the metric defined in config or the order passed in."""
if order is None:
order = self.order
else:
order = QueryGenerator.format_order_key(order)
if order is None:
wandb.termwarn(
"No order specified and couldn't find metric in sweep config, returning most recent run"
)
else:
wandb.termlog("Sorting runs by %s" % order)
filters = {"$and": [{"sweep": self.id}]}
try:
return Runs(
self.client,
self.entity,
self.project,
order=order,
filters=filters,
per_page=1,
)[0]
except IndexError:
return None | python | wandb/apis/public.py | 2,582 | 2,605 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,538 | expected_run_count | def expected_run_count(self) -> Optional[int]:
"""Return the number of expected runs in the sweep or None for infinite runs."""
return self._attrs.get("runCountExpected") | python | wandb/apis/public.py | 2,608 | 2,610 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,539 | path | def path(self):
return [
urllib.parse.quote_plus(str(self.entity)),
urllib.parse.quote_plus(str(self.project)),
urllib.parse.quote_plus(str(self.id)),
] | python | wandb/apis/public.py | 2,613 | 2,618 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,540 | url | def url(self):
path = self.path
path.insert(2, "sweeps")
return self.client.app_url + "/".join(path) | python | wandb/apis/public.py | 2,621 | 2,624 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,541 | name | def name(self):
return self.config.get("name") or self.id | python | wandb/apis/public.py | 2,627 | 2,628 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,542 | get | def get(
cls,
client,
entity=None,
project=None,
sid=None,
order=None,
query=None,
**kwargs,
):
"""Execute a query against the cloud backend."""
if query is None:
query = cls.QUERY
variables = {
"entity": entity,
"project": project,
"name": sid,
}
variables.update(kwargs)
response = None
try:
response = client.execute(query, variable_values=variables)
except Exception:
# Don't handle exception, rely on legacy query
# TODO(gst): Implement updated introspection workaround
query = cls.LEGACY_QUERY
response = client.execute(query, variable_values=variables)
if (
not response
or not response.get("project")
or not response["project"].get("sweep")
):
return None
sweep_response = response["project"]["sweep"]
sweep = cls(client, entity, project, sid, attrs=sweep_response)
sweep.runs = Runs(
client,
entity,
project,
order=order,
per_page=10,
filters={"$and": [{"sweep": sweep.id}]},
)
return sweep | python | wandb/apis/public.py | 2,631 | 2,679 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,543 | to_html | def to_html(self, height=420, hidden=False):
"""Generate HTML containing an iframe displaying this sweep."""
url = self.url + "?jupyter=true"
style = f"border:none;width:100%;height:{height}px;"
prefix = ""
if hidden:
style += "display:none;"
prefix = ipython.toggle_button("sweep")
return prefix + f"<iframe src={url!r} style={style!r}></iframe>" | python | wandb/apis/public.py | 2,681 | 2,689 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,544 | _repr_html_ | def _repr_html_(self) -> str:
return self.to_html() | python | wandb/apis/public.py | 2,691 | 2,692 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,545 | __repr__ | def __repr__(self):
return "<Sweep {} ({})>".format(
"/".join(self.path), self._attrs.get("state", "Unknown State")
) | python | wandb/apis/public.py | 2,694 | 2,697 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,546 | __init__ | def __init__(self, client, run, names=None, per_page=50, upload=False):
self.run = run
variables = {
"project": run.project,
"entity": run.entity,
"name": run.id,
"fileNames": names or [],
"upload": upload,
}
super().__init__(client, variables, per_page) | python | wandb/apis/public.py | 2,719 | 2,728 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,547 | length | def length(self):
if self.last_response:
return self.last_response["project"]["run"]["fileCount"]
else:
return None | python | wandb/apis/public.py | 2,731 | 2,735 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,548 | more | def more(self):
if self.last_response:
return self.last_response["project"]["run"]["files"]["pageInfo"][
"hasNextPage"
]
else:
return True | python | wandb/apis/public.py | 2,738 | 2,744 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,549 | cursor | def cursor(self):
if self.last_response:
return self.last_response["project"]["run"]["files"]["edges"][-1]["cursor"]
else:
return None | python | wandb/apis/public.py | 2,747 | 2,751 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,550 | update_variables | def update_variables(self):
self.variables.update({"fileLimit": self.per_page, "fileCursor": self.cursor}) | python | wandb/apis/public.py | 2,753 | 2,754 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,551 | convert_objects | def convert_objects(self):
return [
File(self.client, r["node"])
for r in self.last_response["project"]["run"]["files"]["edges"]
] | python | wandb/apis/public.py | 2,756 | 2,760 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,552 | __repr__ | def __repr__(self):
return "<Files {} ({})>".format("/".join(self.run.path), len(self)) | python | wandb/apis/public.py | 2,762 | 2,763 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,553 | __init__ | def __init__(self, client, attrs):
self.client = client
self._attrs = attrs
super().__init__(dict(attrs)) | python | wandb/apis/public.py | 2,780 | 2,783 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,554 | size | def size(self):
size_bytes = self._attrs["sizeBytes"]
if size_bytes is not None:
return int(size_bytes)
return 0 | python | wandb/apis/public.py | 2,786 | 2,790 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,555 | download | def download(
self, root: str = ".", replace: bool = False, exist_ok: bool = False
) -> io.TextIOWrapper:
"""Downloads a file previously saved by a run from the wandb server.
Arguments:
replace (boolean): If `True`, download will overwrite a local file
if it exists. Defaults to `False`.
root (str): Local directory to save the file. Defaults to ".".
exist_ok (boolean): If `True`, will not raise ValueError if file already
exists and will not re-download unless replace=True. Defaults to `False`.
Raises:
`ValueError` if file already exists, replace=False and exist_ok=False.
"""
path = os.path.join(root, self.name)
if os.path.exists(path) and not replace:
if exist_ok:
return open(path)
else:
raise ValueError(
"File already exists, pass replace=True to overwrite or exist_ok=True to leave it as is and don't error."
)
util.download_file_from_url(path, self.url, Api().api_key)
return open(path) | python | wandb/apis/public.py | 2,798 | 2,823 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,556 | delete | def delete(self):
mutation = gql(
"""
mutation deleteFiles($files: [ID!]!) {
deleteFiles(input: {
files: $files
}) {
success
}
}
"""
)
self.client.execute(mutation, variable_values={"files": [self.id]}) | python | wandb/apis/public.py | 2,826 | 2,838 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,557 | __repr__ | def __repr__(self):
return "<File {} ({}) {}>".format(
self.name,
self.mimetype,
util.to_human_size(self.size, units=util.POW_2_BYTES),
) | python | wandb/apis/public.py | 2,840 | 2,845 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,558 | __init__ | def __init__(self, client, project, name=None, entity=None, per_page=50):
self.project = project
self.name = name
variables = {
"project": project.name,
"entity": project.entity,
"viewName": self.name,
}
super().__init__(client, variables, per_page) | python | wandb/apis/public.py | 2,884 | 2,892 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,559 | length | def length(self):
# TODO: Add the count the backend
if self.last_response:
return len(self.objects)
else:
return None | python | wandb/apis/public.py | 2,895 | 2,900 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,560 | more | def more(self):
if self.last_response:
return self.last_response["project"]["allViews"]["pageInfo"]["hasNextPage"]
else:
return True | python | wandb/apis/public.py | 2,903 | 2,907 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,561 | cursor | def cursor(self):
if self.last_response:
return self.last_response["project"]["allViews"]["edges"][-1]["cursor"]
else:
return None | python | wandb/apis/public.py | 2,910 | 2,914 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,562 | update_variables | def update_variables(self):
self.variables.update(
{"reportCursor": self.cursor, "reportLimit": self.per_page}
) | python | wandb/apis/public.py | 2,916 | 2,919 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,563 | convert_objects | def convert_objects(self):
if self.last_response["project"] is None:
raise ValueError(
f"Project {self.variables['project']} does not exist under entity {self.variables['entity']}"
)
return [
BetaReport(
self.client,
r["node"],
entity=self.project.entity,
project=self.project.name,
)
for r in self.last_response["project"]["allViews"]["edges"]
] | python | wandb/apis/public.py | 2,921 | 2,934 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,564 | __repr__ | def __repr__(self):
return "<Reports {}>".format("/".join(self.project.path)) | python | wandb/apis/public.py | 2,936 | 2,937 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,565 | __init__ | def __init__(self):
pass | python | wandb/apis/public.py | 2,958 | 2,959 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,566 | format_order_key | def format_order_key(cls, key: str):
if key.startswith("+") or key.startswith("-"):
direction = key[0]
key = key[1:]
else:
direction = "-"
parts = key.split(".")
if len(parts) == 1:
# Assume the user meant summary_metrics if not a run column
if parts[0] not in ["createdAt", "updatedAt", "name", "sweep"]:
return direction + "summary_metrics." + parts[0]
# Assume summary metrics if prefix isn't known
elif parts[0] not in ["config", "summary_metrics", "tags"]:
return direction + ".".join(["summary_metrics"] + parts)
else:
return direction + ".".join(parts) | python | wandb/apis/public.py | 2,962 | 2,977 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,567 | _is_group | def _is_group(self, op):
return op.get("filters") is not None | python | wandb/apis/public.py | 2,979 | 2,980 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,568 | _is_individual | def _is_individual(self, op):
return op.get("key") is not None | python | wandb/apis/public.py | 2,982 | 2,983 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,569 | _to_mongo_op_value | def _to_mongo_op_value(self, op, value):
if op == "=":
return value
else:
return {self.INDIVIDUAL_OP_TO_MONGO[op]: value} | python | wandb/apis/public.py | 2,985 | 2,989 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,570 | key_to_server_path | def key_to_server_path(self, key):
if key["section"] == "config":
return "config." + key["name"]
elif key["section"] == "summary":
return "summary_metrics." + key["name"]
elif key["section"] == "keys_info":
return "keys_info.keys." + key["name"]
elif key["section"] == "run":
return key["name"]
elif key["section"] == "tags":
return "tags." + key["name"]
raise ValueError("Invalid key: %s" % key) | python | wandb/apis/public.py | 2,991 | 3,002 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,571 | server_path_to_key | def server_path_to_key(self, path):
if path.startswith("config."):
return {"section": "config", "name": path.split("config.", 1)[1]}
elif path.startswith("summary_metrics."):
return {"section": "summary", "name": path.split("summary_metrics.", 1)[1]}
elif path.startswith("keys_info.keys."):
return {"section": "keys_info", "name": path.split("keys_info.keys.", 1)[1]}
elif path.startswith("tags."):
return {"section": "tags", "name": path.split("tags.", 1)[1]}
else:
return {"section": "run", "name": path} | python | wandb/apis/public.py | 3,004 | 3,014 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,572 | keys_to_order | def keys_to_order(self, keys):
orders = []
for key in keys["keys"]:
order = self.key_to_server_path(key["key"])
if key.get("ascending"):
order = "+" + order
else:
order = "-" + order
orders.append(order)
# return ",".join(orders)
return orders | python | wandb/apis/public.py | 3,016 | 3,026 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,573 | order_to_keys | def order_to_keys(self, order):
keys = []
for k in order: # orderstr.split(","):
name = k[1:]
if k[0] == "+":
ascending = True
elif k[0] == "-":
ascending = False
else:
raise Exception("you must sort by ascending(+) or descending(-)")
key = {"key": {"section": "run", "name": name}, "ascending": ascending}
keys.append(key)
return {"keys": keys} | python | wandb/apis/public.py | 3,028 | 3,042 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,574 | _to_mongo_individual | def _to_mongo_individual(self, filter):
if filter["key"]["name"] == "":
return None
if filter.get("value") is None and filter["op"] != "=" and filter["op"] != "!=":
return None
if filter.get("disabled") is not None and filter["disabled"]:
return None
if filter["key"]["section"] == "tags":
if filter["op"] == "IN":
return {"tags": {"$in": filter["value"]}}
if filter["value"] is False:
return {
"$or": [{"tags": None}, {"tags": {"$ne": filter["key"]["name"]}}]
}
else:
return {"tags": filter["key"]["name"]}
path = self.key_to_server_path(filter["key"])
if path is None:
return path
return {path: self._to_mongo_op_value(filter["op"], filter["value"])} | python | wandb/apis/public.py | 3,044 | 3,066 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,575 | filter_to_mongo | def filter_to_mongo(self, filter):
if self._is_individual(filter):
return self._to_mongo_individual(filter)
elif self._is_group(filter):
return {
self.GROUP_OP_TO_MONGO[filter["op"]]: [
self.filter_to_mongo(f) for f in filter["filters"]
]
} | python | wandb/apis/public.py | 3,068 | 3,076 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,576 | mongo_to_filter | def mongo_to_filter(self, filter):
# Returns {"op": "OR", "filters": [{"op": "AND", "filters": []}]}
if filter is None:
return None # this covers the case where self.filter_to_mongo returns None.
group_op = None
for key in filter.keys():
# if self.MONGO_TO_GROUP_OP[key]:
if key in self.MONGO_TO_GROUP_OP:
group_op = key
break
if group_op is not None:
return {
"op": self.MONGO_TO_GROUP_OP[group_op],
"filters": [self.mongo_to_filter(f) for f in filter[group_op]],
}
else:
for k, v in filter.items():
if isinstance(v, dict):
# TODO: do we always have one key in this case?
op = next(iter(v.keys()))
return {
"key": self.server_path_to_key(k),
"op": self.MONGO_TO_INDIVIDUAL_OP[op],
"value": v[op],
}
else:
return {"key": self.server_path_to_key(k), "op": "=", "value": v} | python | wandb/apis/public.py | 3,078 | 3,105 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,577 | __init__ | def __init__(self, run_set):
self.run_set = run_set
self.panel_metrics_helper = PanelMetricsHelper() | python | wandb/apis/public.py | 3,167 | 3,169 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,578 | _handle_compare | def _handle_compare(self, node):
# only left side can be a col
left = self.front_to_back(self._handle_fields(node.left))
op = self._handle_ops(node.ops[0])
right = self._handle_fields(node.comparators[0])
# Eq has no op for some reason
if op == "=":
return {left: right}
else:
return {left: {op: right}} | python | wandb/apis/public.py | 3,171 | 3,181 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,579 | _handle_fields | def _handle_fields(self, node):
result = getattr(node, self.AST_FIELDS.get(type(node)))
if isinstance(result, list):
return [self._handle_fields(node) for node in result]
elif isinstance(result, str):
return self._unconvert(result)
return result | python | wandb/apis/public.py | 3,183 | 3,189 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,580 | _handle_ops | def _handle_ops(self, node):
return self.AST_OPERATORS.get(type(node)) | python | wandb/apis/public.py | 3,191 | 3,192 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,581 | _replace_numeric_dots | def _replace_numeric_dots(self, s):
numeric_dots = []
for i, (left, mid, right) in enumerate(zip(s, s[1:], s[2:]), 1):
if mid == ".":
if (
left.isdigit()
and right.isdigit() # 1.2
or left.isdigit()
and right == " " # 1.
or left == " "
and right.isdigit() # .2
):
numeric_dots.append(i)
# Edge: Catch number ending in dot at end of string
if s[-2].isdigit() and s[-1] == ".":
numeric_dots.append(len(s) - 1)
numeric_dots = [-1] + numeric_dots + [len(s)]
substrs = []
for start, stop in zip(numeric_dots, numeric_dots[1:]):
substrs.append(s[start + 1 : stop])
substrs.append(self.DECIMAL_SPACER)
substrs = substrs[:-1]
return "".join(substrs) | python | wandb/apis/public.py | 3,194 | 3,217 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,582 | _convert | def _convert(self, filterstr):
_conversion = (
self._replace_numeric_dots(filterstr) # temporarily sub numeric dots
.replace(".", self.SPACER) # Allow dotted fields
.replace(self.DECIMAL_SPACER, ".") # add them back
)
return "(" + _conversion + ")" | python | wandb/apis/public.py | 3,219 | 3,225 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,583 | _unconvert | def _unconvert(self, field_name):
return field_name.replace(self.SPACER, ".") # Allow dotted fields | python | wandb/apis/public.py | 3,227 | 3,228 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,584 | python_to_mongo | def python_to_mongo(self, filterstr):
try:
tree = ast.parse(self._convert(filterstr), mode="eval")
except SyntaxError as e:
raise ValueError(
"Invalid python comparison expression; form something like `my_col == 123`"
) from e
multiple_filters = hasattr(tree.body, "op")
if multiple_filters:
op = self.AST_OPERATORS.get(type(tree.body.op))
values = [self._handle_compare(v) for v in tree.body.values]
else:
op = "$and"
values = [self._handle_compare(tree.body)]
return {"$or": [{op: values}]} | python | wandb/apis/public.py | 3,230 | 3,246 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,585 | front_to_back | def front_to_back(self, name):
name, *rest = name.split(".")
rest = "." + ".".join(rest) if rest else ""
if name in self.FRONTEND_NAME_MAPPING:
return self.FRONTEND_NAME_MAPPING[name]
elif name in self.FRONTEND_NAME_MAPPING_REVERSED:
return name
elif name in self.run_set._runs_config:
return f"config.{name}.value{rest}"
else: # assume summary metrics
return f"summary_metrics.{name}{rest}" | python | wandb/apis/public.py | 3,248 | 3,259 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,586 | back_to_front | def back_to_front(self, name):
if name in self.FRONTEND_NAME_MAPPING_REVERSED:
return self.FRONTEND_NAME_MAPPING_REVERSED[name]
elif name in self.FRONTEND_NAME_MAPPING:
return name
elif (
name.startswith("config.") and ".value" in name
): # may be brittle: originally "endswith", but that doesn't work with nested keys...
# strip is weird sometimes (??)
return name.replace("config.", "").replace(".value", "")
elif name.startswith("summary_metrics."):
return name.replace("summary_metrics.", "")
wandb.termerror(f"Unknown token: {name}")
return name | python | wandb/apis/public.py | 3,261 | 3,274 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,587 | pc_front_to_back | def pc_front_to_back(self, name):
name, *rest = name.split(".")
rest = "." + ".".join(rest) if rest else ""
if name is None:
return None
elif name in self.panel_metrics_helper.FRONTEND_NAME_MAPPING:
return "summary:" + self.panel_metrics_helper.FRONTEND_NAME_MAPPING[name]
elif name in self.FRONTEND_NAME_MAPPING:
return self.FRONTEND_NAME_MAPPING[name]
elif name in self.FRONTEND_NAME_MAPPING_REVERSED:
return name
elif name in self.run_set._runs_config:
return f"config:{name}.value{rest}"
else: # assume summary metrics
return f"summary:{name}{rest}" | python | wandb/apis/public.py | 3,277 | 3,291 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,588 | pc_back_to_front | def pc_back_to_front(self, name):
if name is None:
return None
elif "summary:" in name:
name = name.replace("summary:", "")
return self.panel_metrics_helper.FRONTEND_NAME_MAPPING_REVERSED.get(
name, name
)
elif name in self.FRONTEND_NAME_MAPPING_REVERSED:
return self.FRONTEND_NAME_MAPPING_REVERSED[name]
elif name in self.FRONTEND_NAME_MAPPING:
return name
elif name.startswith("config:") and ".value" in name:
return name.replace("config:", "").replace(".value", "")
elif name.startswith("summary_metrics."):
return name.replace("summary_metrics.", "")
return name | python | wandb/apis/public.py | 3,293 | 3,309 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,589 | front_to_back | def front_to_back(self, name):
if name in self.FRONTEND_NAME_MAPPING:
return self.FRONTEND_NAME_MAPPING[name]
return name | python | wandb/apis/public.py | 3,324 | 3,327 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,590 | back_to_front | def back_to_front(self, name):
if name in self.FRONTEND_NAME_MAPPING_REVERSED:
return self.FRONTEND_NAME_MAPPING_REVERSED[name]
return name | python | wandb/apis/public.py | 3,329 | 3,332 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,591 | special_front_to_back | def special_front_to_back(self, name):
if name is None:
return name
name, *rest = name.split(".")
rest = "." + ".".join(rest) if rest else ""
# special case for config
if name.startswith("c::"):
name = name[3:]
return f"config:{name}.value{rest}"
# special case for summary
if name.startswith("s::"):
name = name[3:] + rest
return f"summary:{name}"
name = name + rest
if name in self.RUN_MAPPING:
return "run:" + self.RUN_MAPPING[name]
if name in self.FRONTEND_NAME_MAPPING:
return "summary:" + self.FRONTEND_NAME_MAPPING[name]
if name == "Index":
return name
return "summary:" + name | python | wandb/apis/public.py | 3,335 | 3,359 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,592 | special_back_to_front | def special_back_to_front(self, name):
if name is not None:
kind, rest = name.split(":", 1)
if kind == "config":
pieces = rest.split(".")
if len(pieces) <= 1:
raise ValueError(f"Invalid name: {name}")
elif len(pieces) == 2:
name = pieces[0]
elif len(pieces) >= 3:
name = pieces[:1] + pieces[2:]
name = ".".join(name)
return f"c::{name}"
elif kind == "summary":
name = rest
return f"s::{name}"
if name is None:
return name
elif "summary:" in name:
name = name.replace("summary:", "")
return self.FRONTEND_NAME_MAPPING_REVERSED.get(name, name)
elif "run:" in name:
name = name.replace("run:", "")
return self.RUN_MAPPING_REVERSED[name]
return name | python | wandb/apis/public.py | 3,361 | 3,388 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,593 | __init__ | def __init__(self, client, attrs, entity=None, project=None):
self.client = client
self.project = project
self.entity = entity
self.query_generator = QueryGenerator()
super().__init__(dict(attrs))
self._attrs["spec"] = json.loads(self._attrs["spec"]) | python | wandb/apis/public.py | 3,404 | 3,410 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,594 | sections | def sections(self):
return self.spec["panelGroups"] | python | wandb/apis/public.py | 3,413 | 3,414 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,595 | runs | def runs(self, section, per_page=50, only_selected=True):
run_set_idx = section.get("openRunSet", 0)
run_set = section["runSets"][run_set_idx]
order = self.query_generator.key_to_server_path(run_set["sort"]["key"])
if run_set["sort"].get("ascending"):
order = "+" + order
else:
order = "-" + order
filters = self.query_generator.filter_to_mongo(run_set["filters"])
if only_selected:
# TODO: handle this not always existing
filters["$or"][0]["$and"].append(
{"name": {"$in": run_set["selections"]["tree"]}}
)
return Runs(
self.client,
self.entity,
self.project,
filters=filters,
order=order,
per_page=per_page,
) | python | wandb/apis/public.py | 3,416 | 3,437 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,596 | updated_at | def updated_at(self):
return self._attrs["updatedAt"] | python | wandb/apis/public.py | 3,440 | 3,441 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,597 | url | def url(self):
return self.client.app_url + "/".join(
[
self.entity,
self.project,
"reports",
"--".join(
[
urllib.parse.quote(self.display_name.replace(" ", "-")),
self.id.replace("=", ""),
]
),
]
) | python | wandb/apis/public.py | 3,444 | 3,457 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,598 | to_html | def to_html(self, height=1024, hidden=False):
"""Generate HTML containing an iframe displaying this report."""
url = self.url + "?jupyter=true"
style = f"border:none;width:100%;height:{height}px;"
prefix = ""
if hidden:
style += "display:none;"
prefix = ipython.toggle_button("report")
return prefix + f"<iframe src={url!r} style={style!r}></iframe>" | python | wandb/apis/public.py | 3,459 | 3,467 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,599 | _repr_html_ | def _repr_html_(self) -> str:
return self.to_html() | python | wandb/apis/public.py | 3,469 | 3,470 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,600 | __init__ | def __init__(self, client, run, min_step, max_step, page_size=1000):
self.client = client
self.run = run
self.page_size = page_size
self.min_step = min_step
self.max_step = max_step
self.page_offset = min_step # minStep for next page
self.scan_offset = 0 # index within current page of rows
self.rows = [] # current page of rows | python | wandb/apis/public.py | 3,486 | 3,494 | {
"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.