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 |
|---|---|---|---|---|---|---|---|
801 | build_table | def build_table(n_rows, img_dim):
return wandb.Table(
columns=["id", "image"],
data=[
[i, wandb.Image(np.random.randint(0, 255, size=(img_dim, img_dim)))]
for i in range(n_rows)
],
) | python | tests/standalone_tests/artifact_table_load.py | 38 | 45 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
802 | safe_remove_dir | def safe_remove_dir(dir_name):
if dir_name not in [".", "~", "/"] and os.path.exists(dir_name):
shutil.rmtree(dir_name) | python | tests/standalone_tests/artifact_table_load.py | 48 | 50 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
803 | delete_cache | def delete_cache():
safe_remove_dir("./artifacts")
safe_remove_dir("~/.cache/wandb")
safe_remove_dir(artifacts.get_artifacts_cache()._cache_dir) | python | tests/standalone_tests/artifact_table_load.py | 53 | 56 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
804 | cleanup | def cleanup():
delete_cache()
safe_remove_dir("./wandb") | python | tests/standalone_tests/artifact_table_load.py | 59 | 61 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
805 | main | def main(n_rows, img_dim, clear_cache=False):
timer = {
"LOG_TABLE": [None, None],
"GET_TABLE": [None, None],
"LOG_REF": [None, None],
"GET_REF": [None, None],
}
delete_cache()
with wandb.init() as run:
table = build_table(n_rows, img_dim)
artifact = wandb... | python | tests/standalone_tests/artifact_table_load.py | 64 | 118 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
806 | main | def main():
run = wandb.init(config=dict(this=2, that=4))
# not allowed
# run.socket
# run.pid
# run.resume
# run.program
# run.args
# run.storage_id
# TODO: for compatibility
print(run.mode)
print(run.offline)
# future
# print(run.disabled)
print(run.id)
p... | python | tests/standalone_tests/public_run.py | 9 | 56 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
807 | main | def main():
run = wandb.init(name=pathlib.Path(__file__).stem)
run.log({"boom": 1})
run.finish() | python | tests/standalone_tests/basic.py | 6 | 9 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
808 | main | def main():
wandb.init(tensorboard=True)
class ConvNet(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.conv2_drop = nn.Dropout2d()
self.fc1 = nn... | python | tests/standalone_tests/pytorch_tensorboardX.py | 8 | 38 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
809 | __init__ | def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.conv2_drop = nn.Dropout2d()
self.fc1 = nn.Linear(320, 50)
self.fc2 = nn.Linear(50, 10) | python | tests/standalone_tests/pytorch_tensorboardX.py | 12 | 18 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
810 | forward | def forward(self, x):
x = F.relu(F.max_pool2d(self.conv1(x), 2))
x = F.relu(F.max_pool2d(self.conv2_drop(self.conv2(x)), 2))
x = x.view(-1, 320)
x = F.relu(self.fc1(x))
x = F.dropout(x, training=self.training)
x = self.fc2(x)
return F.l... | python | tests/standalone_tests/pytorch_tensorboardX.py | 20 | 27 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
811 | cleanup | def cleanup():
if os.path.isdir("artifacts"):
shutil.rmtree("artifacts")
if os.path.isdir(LOCAL_FOLDER_NAME):
shutil.rmtree(LOCAL_FOLDER_NAME)
if os.path.isdir("wandb"):
shutil.rmtree("wandb")
if os.path.isfile(LOCAL_ASSET_NAME):
os.remove(LOCAL_ASSET_NAME)
if os.... | python | tests/standalone_tests/dsviz_demo.py | 64 | 78 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
812 | download_data | def download_data():
global train_ids
if not os.path.exists(LOCAL_ASSET_NAME):
os.system(f"curl {DL_URL} --output {LOCAL_ASSET_NAME}")
if not os.path.exists(LOCAL_FOLDER_NAME):
os.system(f"tar xzf {LOCAL_ASSET_NAME}")
train_ids = [
name.split(".")[0] for name in os.listdir(trai... | python | tests/standalone_tests/dsviz_demo.py | 81 | 91 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
813 | _check_train_ids | def _check_train_ids():
if train_ids is None:
raise Exception(
"Please download the data using download_data() before attempting to access it."
) | python | tests/standalone_tests/dsviz_demo.py | 94 | 98 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
814 | get_train_image_path | def get_train_image_path(ndx):
_check_train_ids()
return os.path.join(train_dir, train_ids[ndx] + ".jpg") | python | tests/standalone_tests/dsviz_demo.py | 101 | 103 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
815 | get_color_label_image_path | def get_color_label_image_path(ndx):
_check_train_ids()
return os.path.join(color_labels_dir, train_ids[ndx] + "_train_color.png") | python | tests/standalone_tests/dsviz_demo.py | 106 | 108 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
816 | get_label_image_path | def get_label_image_path(ndx):
_check_train_ids()
return os.path.join(labels_dir, train_ids[ndx] + "_train_id.png") | python | tests/standalone_tests/dsviz_demo.py | 111 | 113 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
817 | get_dominant_id_ndx | def get_dominant_id_ndx(np_image):
if isinstance(np_image, wandb.Image):
np_image = np.array(np_image.image)
return BDD_ID_MAP[np.argmax(np.bincount(np_image.astype(int).flatten()))] | python | tests/standalone_tests/dsviz_demo.py | 116 | 119 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
818 | clean_artifacts_dir | def clean_artifacts_dir():
if os.path.isdir("artifacts"):
shutil.rmtree("artifacts") | python | tests/standalone_tests/dsviz_demo.py | 122 | 124 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
819 | mask_to_bounding | def mask_to_bounding(np_image):
if isinstance(np_image, wandb.Image):
np_image = np.array(np_image.image)
data = []
for id_num in BDD_IDS:
matches = np_image == id_num
col_count = np.where(matches.sum(axis=0))[0]
row_count = np.where(matches.sum(axis=1))[0]
if len(c... | python | tests/standalone_tests/dsviz_demo.py | 127 | 154 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
820 | get_scaled_train_image | def get_scaled_train_image(ndx, factor=2):
return Image.open(get_train_image_path(ndx)).reduce(factor) | python | tests/standalone_tests/dsviz_demo.py | 157 | 158 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
821 | get_scaled_mask_label | def get_scaled_mask_label(ndx, factor=2):
return np.array(Image.open(get_label_image_path(ndx)).reduce(factor)) | python | tests/standalone_tests/dsviz_demo.py | 161 | 162 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
822 | get_scaled_bounding_boxes | def get_scaled_bounding_boxes(ndx, factor=2):
return mask_to_bounding(
np.array(Image.open(get_label_image_path(ndx)).reduce(factor))
) | python | tests/standalone_tests/dsviz_demo.py | 165 | 168 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
823 | get_scaled_color_mask | def get_scaled_color_mask(ndx, factor=2):
return Image.open(get_color_label_image_path(ndx)).reduce(factor) | python | tests/standalone_tests/dsviz_demo.py | 171 | 172 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
824 | get_dominant_class | def get_dominant_class(label_mask):
return BDD_CLASSES[get_dominant_id_ndx(label_mask)] | python | tests/standalone_tests/dsviz_demo.py | 175 | 176 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
825 | __init__ | def __init__(self, n_classes):
self.n_classes = n_classes | python | tests/standalone_tests/dsviz_demo.py | 180 | 181 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
826 | train | def train(self, images, masks):
self.min = images.min()
self.max = images.max()
images = (images - self.min) / (self.max - self.min)
step = 1.0 / n_classes
self.quantiles = list(
np.quantile(images, [i * step for i in range(self.n_classes)])
)
self.qua... | python | tests/standalone_tests/dsviz_demo.py | 183 | 192 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
827 | predict | def predict(self, images):
results = np.zeros((images.shape[0], self.outshape[1], self.outshape[2]))
images = ((images - self.min) / (self.max - self.min)).mean(axis=3)
for i in range(self.n_classes):
results[
(self.quantiles[i] < images) & (images <= self.quantiles[i... | python | tests/standalone_tests/dsviz_demo.py | 194 | 201 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
828 | save | def save(self, file_path):
with open(file_path, "wb") as file:
pickle.dump(self, file) | python | tests/standalone_tests/dsviz_demo.py | 203 | 205 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
829 | load | def load(file_path):
model = None
with open(file_path, "rb") as file:
model = pickle.load(file)
return model | python | tests/standalone_tests/dsviz_demo.py | 208 | 212 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
830 | iou | def iou(mask_a, mask_b, class_id):
return np.nan_to_num(
((mask_a == class_id) & (mask_b == class_id)).sum(axis=(1, 2))
/ ((mask_a == class_id) | (mask_b == class_id)).sum(axis=(1, 2)),
0,
0,
0,
) | python | tests/standalone_tests/dsviz_demo.py | 215 | 222 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
831 | score_model | def score_model(model, x_data, mask_data, n_classes):
results = model.predict(x_data)
return np.array([iou(results, mask_data, i) for i in BDD_IDS]).T, results | python | tests/standalone_tests/dsviz_demo.py | 225 | 227 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
832 | make_datasets | def make_datasets(data_table, n_classes):
n_samples = len(data_table.data)
# n_classes = len(BDD_CLASSES)
height = data_table.data[0][1].image.height
width = data_table.data[0][1].image.width
train_data = np.array(
[
np.array(data_table.data[i][1].image).reshape(height, width, 3... | python | tests/standalone_tests/dsviz_demo.py | 230 | 248 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
833 | main | def main():
try:
# Download the data if not already
download_data()
# Initialize the run
with wandb.init(
project=WANDB_PROJECT, # The project to register this Run to
job_type="create_dataset", # The type of this Run. Runs of the same type can be grouped to... | python | tests/standalone_tests/dsviz_demo.py | 251 | 517 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
834 | gen_files | def gen_files(n_files, max_small_size, max_large_size):
bufsize = max_large_size * 100
# create a random buffer to pull from. drawing ranges from this buffer is
# orders of magnitude faster than creating random contents for each file.
buf = "".join(random.choices(string.ascii_uppercase + string.digits,... | python | tests/standalone_tests/artifact_load.py | 76 | 98 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
835 | proc_version_writer | def proc_version_writer(
stop_queue,
stats_queue,
project_name,
fnames,
artifact_name,
files_per_version_min,
files_per_version_max,
blocking,
):
while True:
try:
stop_queue.get_nowait()
print("Writer stopping")
return
except queue.... | python | tests/standalone_tests/artifact_load.py | 101 | 134 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
836 | _train | def _train(chunk, artifact_name, project_name, group_name):
with wandb.init(
reinit=True, project=project_name, group=group_name, job_type="writer"
) as run:
art = wandb.Artifact(artifact_name, type="dataset")
for file in chunk:
art.add_file(file)
run.upsert_artifact(... | python | tests/standalone_tests/artifact_load.py | 137 | 144 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
837 | proc_version_writer_distributed | def proc_version_writer_distributed(
stop_queue,
stats_queue,
project_name,
fnames,
artifact_name,
files_per_version_min,
files_per_version_max,
fanout,
blocking,
):
while True:
try:
stop_queue.get_nowait()
print("Writer stopping")
retu... | python | tests/standalone_tests/artifact_load.py | 147 | 191 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
838 | proc_version_reader | def proc_version_reader(
stop_queue, stats_queue, project_name, artifact_name, reader_id
):
api = wandb.Api()
# initial sleep to ensure we've created the sequence. Public API fails
# with a nasty error if not.
time.sleep(10)
while True:
try:
stop_queue.get_nowait()
... | python | tests/standalone_tests/artifact_load.py | 194 | 242 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
839 | proc_version_deleter | def proc_version_deleter(
stop_queue, stats_queue, artifact_name, min_versions, delete_period_max
):
api = wandb.Api()
# initial sleep to ensure we've created the sequence. Public API fails
# with a nasty error if not.
time.sleep(10)
while True:
try:
stop_queue.get_nowait()
... | python | tests/standalone_tests/artifact_load.py | 245 | 272 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
840 | proc_cache_garbage_collector | def proc_cache_garbage_collector(stop_queue, cache_gc_period_max):
while True:
try:
stop_queue.get_nowait()
print("GC stopping")
return
except queue.Empty:
pass
time.sleep(random.randrange(cache_gc_period_max))
print("Cache GC")
... | python | tests/standalone_tests/artifact_load.py | 275 | 285 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
841 | proc_bucket_garbage_collector | def proc_bucket_garbage_collector(stop_queue, bucket_gc_period_max):
while True:
time.sleep(random.randrange(bucket_gc_period_max))
print("Bucket GC")
# TODO: implement bucket gc | python | tests/standalone_tests/artifact_load.py | 288 | 292 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
842 | main | def main(argv): # noqa: C901
args = parser.parse_args()
print("Load test starting")
project_name = args.project
if project_name is None:
project_name = "artifacts-load-test-%s" % str(datetime.now()).replace(
" ", "-"
).replace(":", "-").replace(".", "-")
env_project = ... | python | tests/standalone_tests/artifact_load.py | 295 | 508 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
843 | dummy_torch_tensor | def dummy_torch_tensor(size, requires_grad=True):
if parse_version(torch.__version__) >= parse_version("0.4"):
return torch.ones(size, requires_grad=requires_grad)
else:
return torch.autograd.Variable(torch.ones(size), requires_grad=requires_grad) | python | tests/standalone_tests/all_media_types.py | 17 | 21 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
844 | main | def main():
wandb.init()
histogram_small_literal = wandb.Histogram(np_histogram=([1, 2, 4], [3, 10, 20, 0]))
histogram_large_random = wandb.Histogram(numpy.random.randint(255, size=(1000)))
numpy_array = numpy.random.rand(1000)
torch_tensor = torch.rand(1000, 1000)
data_frame = pandas.DataFrame... | python | tests/standalone_tests/all_media_types.py | 24 | 194 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
845 | artifact_with_various_paths | def artifact_with_various_paths():
art = wandb.Artifact(type="artsy", name="my-artys")
# internal file
with open("random.txt", "w") as f:
f.write("file1 %s" % random.random())
f.close()
art.add_file(f.name)
# internal file (using new_file)
with art.new_file("a.txt") as f:
... | python | tests/standalone_tests/artifact_storage.py | 9 | 43 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
846 | main | def main(argv):
# set global entity and project before chdir'ing
from wandb.apis import InternalApi
api = InternalApi()
os.environ["WANDB_ENTITY"] = api.settings("entity")
os.environ["WANDB_PROJECT"] = api.settings("project")
# Change dir to avoid litering code directory
tempdir = tempfile... | python | tests/standalone_tests/artifact_storage.py | 46 | 106 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
847 | func | def func():
entity, project = None, None
run_id = None
with wandb.init() as run:
run_id = run.id
artifact = wandb.Artifact(f"boom-name-{run_id}", type="boom-type")
table = wandb.Table(columns=["boom_col"])
table.add_data(5)
artifact.add(table, name="table")
wa... | python | tests/standalone_tests/history_step_guardrail_log_artifact.py | 11 | 29 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
848 | main | def main(size: int) -> None:
run = wandb.init(settings={"console": "off"})
run.log({f"v_{i}": i for i in range(size)})
run.finish() | python | tests/standalone_tests/log_large_data.py | 7 | 11 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
849 | main | def main():
run = wandb.init()
history = 20
for i in range(history):
if i % 10 == 0:
print(i)
run.log(dict(num=i))
time.sleep(0.1)
print("done")
run.finish() | python | tests/standalone_tests/mitm_tests/mem_pressure.py | 8 | 17 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
850 | test_uwsgi | def test_uwsgi():
with wandb.init() as run:
dataset_name = "check_uwsgi_flask"
artifact = wandb.Artifact(dataset_name, type="dataset")
artifact.metadata["datasetName"] = dataset_name
run.log_artifact(artifact)
return jsonify(status="success", run=run.name), 200 | python | tests/standalone_tests/executor_tests/flask_app.py | 10 | 16 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
851 | immutable_keys | def immutable_keys() -> List[str]:
"""These are env keys that shouldn't change within a single process. We use this to maintain
certain values between multiple calls to wandb.init within a single process."""
return [
DIR,
ENTITY,
PROJECT,
API_KEY,
IGNORE,
DIS... | python | wandb/env.py | 88 | 122 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
852 | _env_as_bool | def _env_as_bool(
var: str, default: Optional[str] = None, env: Optional[Env] = None
) -> bool:
if env is None:
env = os.environ
val = env.get(var, default)
try:
val = bool(strtobool(val)) # type: ignore
except (AttributeError, ValueError):
pass
return val if isinstance(... | python | wandb/env.py | 125 | 135 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
853 | is_debug | def is_debug(default: Optional[str] = None, env: Optional[Env] = None) -> bool:
return _env_as_bool(DEBUG, default=default, env=env) | python | wandb/env.py | 138 | 139 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
854 | error_reporting_enabled | def error_reporting_enabled() -> bool:
return _env_as_bool(ERROR_REPORTING, default="True") | python | wandb/env.py | 142 | 143 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
855 | ssl_disabled | def ssl_disabled() -> bool:
return _env_as_bool(DISABLE_SSL, default="False") | python | wandb/env.py | 146 | 147 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
856 | get_error_reporting | def get_error_reporting(
default: Union[bool, str] = True,
env: Optional[Env] = None,
) -> Union[bool, str]:
if env is None:
env = os.environ
return env.get(ERROR_REPORTING, default) | python | wandb/env.py | 150 | 157 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
857 | get_run | def get_run(default: Optional[str] = None, env: Optional[Env] = None) -> Optional[str]:
if env is None:
env = os.environ
return env.get(RUN_ID, default) | python | wandb/env.py | 160 | 164 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
858 | get_args | def get_args(
default: Optional[List[str]] = None, env: Optional[Env] = None
) -> Optional[List[str]]:
if env is None:
env = os.environ
if env.get(ARGS):
try:
return json.loads(env.get(ARGS, "[]")) # type: ignore
except ValueError:
return None
else:
... | python | wandb/env.py | 167 | 178 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
859 | get_docker | def get_docker(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[str]:
if env is None:
env = os.environ
return env.get(DOCKER, default) | python | wandb/env.py | 181 | 187 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
860 | get_http_timeout | def get_http_timeout(default: int = 10, env: Optional[Env] = None) -> int:
if env is None:
env = os.environ
return int(env.get(HTTP_TIMEOUT, default)) | python | wandb/env.py | 190 | 194 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
861 | get_ignore | def get_ignore(
default: Optional[List[str]] = None, env: Optional[Env] = None
) -> Optional[List[str]]:
if env is None:
env = os.environ
ignore = env.get(IGNORE)
if ignore is not None:
return ignore.split(",")
else:
return default | python | wandb/env.py | 197 | 206 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
862 | get_project | def get_project(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[str]:
if env is None:
env = os.environ
return env.get(PROJECT, default) | python | wandb/env.py | 209 | 215 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
863 | get_username | def get_username(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[str]:
if env is None:
env = os.environ
return env.get(USERNAME, default) | python | wandb/env.py | 218 | 224 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
864 | get_user_email | def get_user_email(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[str]:
if env is None:
env = os.environ
return env.get(USER_EMAIL, default) | python | wandb/env.py | 227 | 233 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
865 | get_entity | def get_entity(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[str]:
if env is None:
env = os.environ
return env.get(ENTITY, default) | python | wandb/env.py | 236 | 242 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
866 | get_base_url | def get_base_url(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[str]:
if env is None:
env = os.environ
base_url = env.get(BASE_URL, default)
return base_url.rstrip("/") if base_url is not None else base_url | python | wandb/env.py | 245 | 253 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
867 | get_app_url | def get_app_url(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[str]:
if env is None:
env = os.environ
return env.get(APP_URL, default) | python | wandb/env.py | 256 | 262 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
868 | get_show_run | def get_show_run(default: Optional[str] = None, env: Optional[Env] = None) -> bool:
if env is None:
env = os.environ
return bool(env.get(SHOW_RUN, default)) | python | wandb/env.py | 265 | 269 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
869 | get_description | def get_description(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[str]:
if env is None:
env = os.environ
return env.get(DESCRIPTION, default) | python | wandb/env.py | 272 | 278 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
870 | get_tags | def get_tags(default: str = "", env: Optional[Env] = None) -> List[str]:
if env is None:
env = os.environ
return [tag for tag in env.get(TAGS, default).split(",") if tag] | python | wandb/env.py | 281 | 285 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
871 | get_dir | def get_dir(default: Optional[str] = None, env: Optional[Env] = None) -> Optional[str]:
if env is None:
env = os.environ
return env.get(DIR, default) | python | wandb/env.py | 288 | 291 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
872 | get_config_paths | def get_config_paths(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[str]:
if env is None:
env = os.environ
return env.get(CONFIG_PATHS, default) | python | wandb/env.py | 294 | 299 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
873 | get_agent_report_interval | def get_agent_report_interval(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[int]:
if env is None:
env = os.environ
val = env.get(AGENT_REPORT_INTERVAL, default)
try:
val = int(val) # type: ignore
except ValueError:
val = None # silently ignore env ... | python | wandb/env.py | 302 | 312 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
874 | get_agent_kill_delay | def get_agent_kill_delay(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[int]:
if env is None:
env = os.environ
val = env.get(AGENT_KILL_DELAY, default)
try:
val = int(val) # type: ignore
except ValueError:
val = None # silently ignore env format err... | python | wandb/env.py | 315 | 325 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
875 | get_crash_nosync_time | def get_crash_nosync_time(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[int]:
if env is None:
env = os.environ
val = env.get(CRASH_NOSYNC_TIME, default)
try:
val = int(val) # type: ignore
except ValueError:
val = None # silently ignore env format e... | python | wandb/env.py | 328 | 338 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
876 | get_magic | def get_magic(
default: Optional[str] = None, env: Optional[Env] = None
) -> Optional[str]:
if env is None:
env = os.environ
val = env.get(MAGIC, default)
return val | python | wandb/env.py | 341 | 347 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
877 | get_data_dir | def get_data_dir(env: Optional[Env] = None) -> str:
default_dir = appdirs.user_data_dir("wandb")
if env is None:
env = os.environ
val = env.get(DATA_DIR, default_dir)
return val | python | wandb/env.py | 350 | 355 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
878 | get_cache_dir | def get_cache_dir(env: Optional[Env] = None) -> str:
default_dir = appdirs.user_cache_dir("wandb")
if env is None:
env = os.environ
val = env.get(CACHE_DIR, default_dir)
return val | python | wandb/env.py | 358 | 363 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
879 | get_use_v1_artifacts | def get_use_v1_artifacts(env: Optional[Env] = None) -> bool:
if env is None:
env = os.environ
val = bool(env.get(USE_V1_ARTIFACTS, False))
return val | python | wandb/env.py | 366 | 370 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
880 | get_agent_max_initial_failures | def get_agent_max_initial_failures(
default: Optional[int] = None, env: Optional[Env] = None
) -> Optional[int]:
if env is None:
env = os.environ
val = env.get(AGENT_MAX_INITIAL_FAILURES, default)
try:
val = int(val) # type: ignore
except ValueError:
val = default
return... | python | wandb/env.py | 373 | 383 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
881 | set_entity | def set_entity(value: str, env: Optional[Env] = None) -> None:
if env is None:
env = os.environ
env[ENTITY] = value | python | wandb/env.py | 386 | 389 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
882 | set_project | def set_project(value: str, env: Optional[Env] = None) -> None:
if env is None:
env = os.environ
env[PROJECT] = value or "uncategorized" | python | wandb/env.py | 392 | 395 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
883 | should_save_code | def should_save_code() -> bool:
save_code = _env_as_bool(SAVE_CODE, default="False")
code_disabled = _env_as_bool(DISABLE_CODE, default="False")
return save_code and not code_disabled | python | wandb/env.py | 398 | 401 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
884 | disable_git | def disable_git(env: Optional[Env] = None) -> bool:
if env is None:
env = os.environ
val = env.get(DISABLE_GIT, default="False")
if isinstance(val, str):
val = False if val.lower() == "false" else True
return val | python | wandb/env.py | 404 | 410 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
885 | _datatypes_set_callback | def _datatypes_set_callback(cb):
global _glob_datatypes_callback
_glob_datatypes_callback = cb | python | wandb/_globals.py | 12 | 14 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
886 | _datatypes_callback | def _datatypes_callback(fname):
if _glob_datatypes_callback:
_glob_datatypes_callback(fname) | python | wandb/_globals.py | 17 | 19 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
887 | get_platform_name | def get_platform_name() -> str:
if sys.platform.startswith("win"):
return PLATFORM_WINDOWS
elif sys.platform.startswith("darwin"):
return PLATFORM_DARWIN
elif sys.platform.startswith("linux"):
return PLATFORM_LINUX
elif sys.platform.startswith(
(
"dragonfly",
... | python | wandb/util.py | 113 | 130 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
888 | vendor_setup | def vendor_setup() -> Callable:
"""Create a function that restores user paths after vendor imports.
This enables us to use the vendor directory for packages we don't depend on. Call
the returned function after imports are complete. If you don't you may modify the
user's path which is never good.
U... | python | wandb/util.py | 154 | 187 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
889 | reset_import_path | def reset_import_path() -> None:
sys.path = original_path | python | wandb/util.py | 171 | 172 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
890 | vendor_import | def vendor_import(name: str) -> Any:
reset_path = vendor_setup()
module = import_module(name)
reset_path()
return module | python | wandb/util.py | 190 | 194 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
891 | import_module_lazy | def import_module_lazy(name: str) -> Any:
"""Import a module lazily, only when it is used.
:param (str) name: Dot-separated module path. E.g., 'scipy.stats'.
"""
try:
return sys.modules[name]
except KeyError:
module_spec = importlib.util.find_spec(name)
if not module_spec:
... | python | wandb/util.py | 197 | 216 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
892 | get_module | def get_module(
name: str,
required: Optional[Union[str, bool]] = None,
lazy: bool = True,
) -> Any:
"""Return module or None. Absolute import is required.
:param (str) name: Dot-separated module path. E.g., 'scipy.stats'.
:param (str) required: A string to raise a ValueError if missing
:pa... | python | wandb/util.py | 219 | 243 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
893 | get_optional_module | def get_optional_module(name) -> Optional["importlib.ModuleInterface"]: # type: ignore
return get_module(name) | python | wandb/util.py | 246 | 247 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
894 | app_url | def app_url(api_url: str) -> str:
"""Return the frontend app url without a trailing slash."""
# TODO: move me to settings
app_url = get_app_url()
if app_url is not None:
return str(app_url.strip("/"))
if "://api.wandb.test" in api_url:
# dev mode
return api_url.replace("://ap... | python | wandb/util.py | 256 | 272 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
895 | get_full_typename | def get_full_typename(o: Any) -> Any:
"""Determine types based on type names.
Avoids needing to to import (and therefore depend on) PyTorch, TensorFlow, etc.
"""
instance_name = o.__class__.__module__ + "." + o.__class__.__name__
if instance_name in ["builtins.module", "__builtin__.module"]:
... | python | wandb/util.py | 275 | 284 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
896 | get_h5_typename | def get_h5_typename(o: Any) -> Any:
typename = get_full_typename(o)
if is_tf_tensor_typename(typename):
return "tensorflow.Tensor"
elif is_pytorch_tensor_typename(typename):
return "torch.Tensor"
else:
return o.__class__.__module__.split(".")[0] + "." + o.__class__.__name__ | python | wandb/util.py | 287 | 294 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
897 | is_uri | def is_uri(string: str) -> bool:
parsed_uri = urllib.parse.urlparse(string)
return len(parsed_uri.scheme) > 0 | python | wandb/util.py | 297 | 299 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
898 | local_file_uri_to_path | def local_file_uri_to_path(uri: str) -> str:
"""Convert URI to local filesystem path.
No-op if the uri does not have the expected scheme.
"""
path = urllib.parse.urlparse(uri).path if uri.startswith("file:") else uri
return urllib.request.url2pathname(path) | python | wandb/util.py | 302 | 308 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
899 | get_local_path_or_none | def get_local_path_or_none(path_or_uri: str) -> Optional[str]:
"""Return path if local, None otherwise.
Return None if the argument is a local path (not a scheme or file:///). Otherwise
return `path_or_uri`.
"""
parsed_uri = urllib.parse.urlparse(path_or_uri)
if (
len(parsed_uri.scheme)... | python | wandb/util.py | 311 | 325 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
900 | make_tarfile | def make_tarfile(
output_filename: str,
source_dir: str,
archive_name: str,
custom_filter: Optional[Callable] = None,
) -> None:
# Helper for filtering out modification timestamps
def _filter_timestamps(tar_info: "tarfile.TarInfo") -> Optional["tarfile.TarInfo"]:
tar_info.mtime = 0
... | python | wandb/util.py | 328 | 351 | {
"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.