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 |
|---|---|---|---|---|---|---|---|
201 | testing_pipeline | def testing_pipeline(seed: int, a: float, b: float):
conf = dsl.get_pipeline_conf()
conf.add_op_transformer(add_wandb_env_variables)
add_task = add(a, b)
add_task2 = add(add_task.output, add_task.output) # noqa: F841 | python | tests/functional_tests/t0_main/kfp/kfp-pipeline-simple.py | 43 | 47 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
202 | setup | def setup(rank, world_size):
os.environ["MASTER_ADDR"] = "localhost"
os.environ["MASTER_PORT"] = "12355"
# initialize the process group
dist.init_process_group("gloo", rank=rank, world_size=world_size) | python | tests/functional_tests/t0_main/torch/t3_ddp_basic.py | 13 | 18 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
203 | cleanup | def cleanup():
dist.destroy_process_group() | python | tests/functional_tests/t0_main/torch/t3_ddp_basic.py | 21 | 22 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
204 | __init__ | def __init__(self):
super().__init__()
self.net1 = nn.Linear(10, 10)
self.relu = nn.ReLU()
self.net2 = nn.Linear(10, 5) | python | tests/functional_tests/t0_main/torch/t3_ddp_basic.py | 26 | 30 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
205 | forward | def forward(self, x):
return self.net2(self.relu(self.net1(x))) | python | tests/functional_tests/t0_main/torch/t3_ddp_basic.py | 32 | 33 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
206 | demo_basic | def demo_basic(rank, world_size):
print(f"Running basic DDP example on rank {rank}.")
setup(rank, world_size)
if torch.cuda.is_available():
device = rank
device_ids = [rank]
else:
device = torch.device("cpu")
device_ids = []
# create model and move it to GPU with id... | python | tests/functional_tests/t0_main/torch/t3_ddp_basic.py | 36 | 66 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
207 | main | def main():
run = wandb.init()
# We will use Shakespeare Sonnet 2
test_sentence = """When forty winters shall besiege thy brow,
And dig deep trenches in thy beauty's field,
Thy youth's proud livery so gazed on now,
Will be a totter'd weed of small worth held:
Then being asked, where all thy... | python | tests/functional_tests/t0_main/torch/t1_sparse_tensors.py | 12 | 100 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
208 | __init__ | def __init__(self, vocab_size, embedding_dim, context_size):
super().__init__()
self.embeddings = nn.Embedding(vocab_size, embedding_dim, sparse=True)
self.linear1 = nn.Linear(context_size * embedding_dim, 128)
self.linear2 = nn.Linear(128, vocab_size) | python | tests/functional_tests/t0_main/torch/t1_sparse_tensors.py | 41 | 45 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
209 | forward | def forward(self, inputs):
embeds = self.embeddings(inputs).view((1, -1))
out = tnnf.relu(self.linear1(embeds))
out = self.linear2(out)
log_probs = tnnf.log_softmax(out, dim=1)
return log_probs | python | tests/functional_tests/t0_main/torch/t1_sparse_tensors.py | 47 | 52 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
210 | __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/functional_tests/t0_main/torch/t2_mp_simple.py | 20 | 26 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
211 | 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.log_softmax(x, dim=1) | python | tests/functional_tests/t0_main/torch/t2_mp_simple.py | 28 | 35 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
212 | __init__ | def __init__(self, transform, size=BATCH_SIZE * LOG_INTERVAL * 5) -> None:
self.data = torch.randint(0, 256, (size, 28, 28), dtype=torch.uint8)
self.targets = torch.randint(0, 10, (size,))
self.transform = transform | python | tests/functional_tests/t0_main/torch/t2_mp_simple.py | 39 | 42 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
213 | __getitem__ | def __getitem__(self, index: int):
img, target = self.data[index], int(self.targets[index])
img = Image.fromarray(img.numpy(), mode="L")
if self.transform is not None:
img = self.transform(img)
return img, target | python | tests/functional_tests/t0_main/torch/t2_mp_simple.py | 44 | 52 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
214 | __len__ | def __len__(self) -> int:
return len(self.data) | python | tests/functional_tests/t0_main/torch/t2_mp_simple.py | 54 | 55 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
215 | train | def train(run, rank, model, device, dataset):
torch.manual_seed(SEED + rank)
dataloader_kwargs = {"batch_size": BATCH_SIZE, "shuffle": True}
train_loader = torch.utils.data.DataLoader(dataset, **dataloader_kwargs)
optimizer = optim.SGD(model.parameters(), lr=0.01, momentum=0.5)
run.define_metric(f... | python | tests/functional_tests/t0_main/torch/t2_mp_simple.py | 58 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
216 | train_epoch | def train_epoch(run, epoch, model, device, data_loader, optimizer):
model.train()
pid = os.getpid()
for batch_idx, (data, target) in enumerate(data_loader):
optimizer.zero_grad()
output = model(data.to(device))
loss = F.nll_loss(output, target.to(device))
loss.backward()
... | python | tests/functional_tests/t0_main/torch/t2_mp_simple.py | 70 | 90 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
217 | main | def main():
wandb.init()
test_dir = os.path.dirname(os.path.abspath(__file__))
summary_pb_filename = os.path.join(
test_dir,
"wandb_tensorflow_summary.pb",
)
summary_pb = open(summary_pb_filename, "rb").read()
wandb.tensorboard.log(summary_pb) | python | tests/functional_tests/t0_main/tensorflow/t1_tensorflow_log.py | 6 | 15 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
218 | main | def main():
wandb.init()
get_or_create_global_step = getattr(
tf.train, "get_or_create_global", tf.compat.v1.train.get_or_create_global_step
)
MonitoredTrainingSession = getattr( # noqa: N806
tf.train,
"MonitoredTrainingSession",
tf.compat.v1.train.MonitoredTrainingSes... | python | tests/functional_tests/t0_main/tensorflow/t2_tensorflow_hook.py | 6 | 56 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
219 | process_child | def process_child(attach_id):
run_child = wandb.attach(attach_id=attach_id)
run_child.config.c2 = 22
run_child.log({"s1": 21})
run_child.log({"s2": 22})
run_child.log({"s3": 23})
print("child output") | python | tests/functional_tests/t0_main/mp/07-attach.py | 10 | 16 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
220 | main | def main():
wandb.require("service")
run = wandb.init()
print("parent output")
run.config.c1 = 11
run.log(dict(s2=12, s4=14))
# Start a new run in parallel in a child process
attach_id = run.id
p = mp.Process(target=process_child, kwargs=dict(attach_id=attach_id))
p.start()
p.j... | python | tests/functional_tests/t0_main/mp/07-attach.py | 19 | 35 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
221 | process_child | def process_child(run, check_warning=False):
run.config.c2 = 22
f = io.StringIO()
with redirect_stderr(f):
run.log({"s1": 210}, step=12, commit=True)
found_warning = (
"Note that setting step in multiprocessing can result in data loss. Please log your step values as a metric su... | python | tests/functional_tests/t0_main/mp/06-2-share-child-gt-step.py | 17 | 29 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
222 | process_parent | def process_parent(run):
assert run == wandb.run
run.config.c1 = 11
run.log({"s1": 11}) | python | tests/functional_tests/t0_main/mp/06-2-share-child-gt-step.py | 32 | 35 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
223 | share_run | def share_run():
with wandb.init() as run:
process_parent(run)
# Start a new run in parallel in a child process
p = mp.Process(target=process_child, kwargs=dict(run=run, check_warning=True))
p.start()
p.join() | python | tests/functional_tests/t0_main/mp/06-2-share-child-gt-step.py | 38 | 44 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
224 | reference_run | def reference_run():
with wandb.init() as run:
process_parent(run)
process_child(run=run) | python | tests/functional_tests/t0_main/mp/06-2-share-child-gt-step.py | 47 | 50 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
225 | main | def main():
wandb.require("service")
reference_run()
share_run() | python | tests/functional_tests/t0_main/mp/06-2-share-child-gt-step.py | 53 | 58 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
226 | do_run | def do_run(num):
run = wandb.init()
run.config.id = num
run.log(dict(s=num))
run.finish()
return num | python | tests/functional_tests/t0_main/mp/04-pool.py | 10 | 15 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
227 | main | def main():
wandb.require("service")
wandb.setup()
num_proc = 4
pool = mp.Pool(processes=num_proc)
result = pool.map_async(do_run, range(num_proc))
data = result.get(60)
print(f"DEBUG: {data}")
assert len(data) == 4 | python | tests/functional_tests/t0_main/mp/04-pool.py | 18 | 27 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
228 | process_child | def process_child(attach_id):
run = wandb.attach(attach_id=attach_id)
rng = np.random.default_rng(os.getpid())
height = width = 2
media = [wandb.Image(rng.random((height, width))) for _ in range(3)]
run.log({"media": media}) | python | tests/functional_tests/t0_main/mp/19-2-log-image-sequence-attach.py | 9 | 15 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
229 | main | def main():
wandb.require("service")
run = wandb.init()
# Start a new run in parallel in a child process
processes = [
mp.Process(target=process_child, kwargs=dict(attach_id=run._attach_id))
for _ in range(2)
]
for p in processes:
p.start()
for p in processes:
... | python | tests/functional_tests/t0_main/mp/19-2-log-image-sequence-attach.py | 18 | 33 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
230 | worker | def worker(log, info):
log(info)
return info | python | tests/functional_tests/t0_main/mp/20-1-process-pool-executor.py | 13 | 15 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
231 | main | def main():
wandb.require("service")
with wandb.init() as run:
with ProcessPoolExecutor() as executor:
# log handler
for i in range(3):
future = executor.submit(worker, run.log, {"a": i})
print(future.result()) | python | tests/functional_tests/t0_main/mp/20-1-process-pool-executor.py | 18 | 25 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
232 | main | def main():
wandb.require("service")
run = wandb.init()
run.log(dict(m1=1))
run.log(dict(m2=2))
with open("my-dataset.txt", "w") as fp:
fp.write("this-is-data")
artifact = wandb.Artifact("my-dataset", type="dataset")
table = wandb.Table(columns=["a", "b", "c"], data=[[1, 2, 3]])
... | python | tests/functional_tests/t0_main/mp/14-artifact-log.py | 6 | 22 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
233 | train_step | def train_step(model, optimizer, x_train, y_train):
with tf.GradientTape() as tape:
predictions = model(x_train, training=True)
loss = loss_object(y_train, predictions)
grads = tape.gradient(loss, model.trainable_variables)
optimizer.apply_gradients(zip(grads, model.trainable_variables))
... | python | tests/functional_tests/t0_main/mp/13-synctb-gradienttape.py | 44 | 52 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
234 | test_step | def test_step(model, x_test, y_test):
predictions = model(x_test)
loss = loss_object(y_test, predictions)
test_loss(loss)
test_accuracy(y_test, predictions) | python | tests/functional_tests/t0_main/mp/13-synctb-gradienttape.py | 55 | 60 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
235 | create_model | def create_model():
return tf.keras.models.Sequential(
[
tf.keras.layers.Flatten(input_shape=(28, 28)),
tf.keras.layers.Dense(512, activation="relu"),
tf.keras.layers.Dropout(wandb.config.dropout),
tf.keras.layers.Dense(10, activation="softmax"),
]
... | python | tests/functional_tests/t0_main/mp/13-synctb-gradienttape.py | 71 | 79 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
236 | worker_process | def worker_process(run, i):
with i.get_lock():
i.value += 1
run.log({"i": i.value}) | python | tests/functional_tests/t0_main/mp/06-4-share-child-synchronize.py | 10 | 13 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
237 | main | def main():
wandb.require("service")
run = wandb.init()
counter = mp.Value("i", 0)
workers = [
mp.Process(target=worker_process, kwargs=dict(run=run, i=counter))
for _ in range(4)
]
for w in workers:
w.start()
for w in workers:
w.join() | python | tests/functional_tests/t0_main/mp/06-4-share-child-synchronize.py | 16 | 30 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
238 | process_parent | def process_parent():
run = wandb.init()
assert run == wandb.run
run.config.c1 = 11
run.log({"s1": 11})
return run | python | tests/functional_tests/t0_main/mp/06-5-share-child-non-service.py | 12 | 18 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
239 | process_child | def process_child(run):
# run.config.c2 = 22
run.log({"s1": 21}) | python | tests/functional_tests/t0_main/mp/06-5-share-child-non-service.py | 21 | 23 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
240 | share_run | def share_run():
run = process_parent()
p = mp.Process(target=process_child, kwargs=dict(run=run))
p.start()
p.join()
run.finish() | python | tests/functional_tests/t0_main/mp/06-5-share-child-non-service.py | 26 | 31 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
241 | main | def main():
share_run() | python | tests/functional_tests/t0_main/mp/06-5-share-child-non-service.py | 34 | 35 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
242 | process_parent | def process_parent():
run = wandb.init()
assert run == wandb.run
run.config.c1 = 11
run.log({"s1": 11})
return run | python | tests/functional_tests/t0_main/mp/06-1-share-child-base.py | 12 | 18 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
243 | process_child | def process_child(run):
run.config.c2 = 22
run.log({"s1": 21}) | python | tests/functional_tests/t0_main/mp/06-1-share-child-base.py | 21 | 23 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
244 | reference_run | def reference_run():
run = process_parent()
process_child(run)
run.finish() | python | tests/functional_tests/t0_main/mp/06-1-share-child-base.py | 26 | 29 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
245 | share_run | def share_run():
run = process_parent()
p = mp.Process(target=process_child, kwargs=dict(run=run))
p.start()
p.join()
run.finish() | python | tests/functional_tests/t0_main/mp/06-1-share-child-base.py | 32 | 37 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
246 | main | def main():
wandb.require("service")
reference_run()
share_run() | python | tests/functional_tests/t0_main/mp/06-1-share-child-base.py | 40 | 44 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
247 | process_child | def process_child(run):
# need to re-seed the rng otherwise we get image collision
rng = np.random.default_rng(os.getpid())
height = width = 2
media = [wandb.Image(rng.random((height, width))) for _ in range(3)]
run.log({"media": media}) | python | tests/functional_tests/t0_main/mp/19-1-log-image-sequence.py | 15 | 21 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
248 | main | def main():
wandb.require("service")
run = wandb.init()
# Start a new run in parallel in a child process
processes = [
mp.Process(target=process_child, kwargs=dict(run=run)) for _ in range(2)
]
for p in processes:
p.start()
for p in processes:
p.join()
run.fini... | python | tests/functional_tests/t0_main/mp/19-1-log-image-sequence.py | 24 | 38 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
249 | process_child | def process_child(run, check_warning=False):
run.config.c2 = 22
f = io.StringIO()
with redirect_stderr(f):
run.log({"s1": 210}, step=3, commit=True)
found_warning = (
"Note that setting step in multiprocessing can result in data loss. Please log your step values as a metric suc... | python | tests/functional_tests/t0_main/mp/06-3-share-child-lt-step.py | 16 | 27 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
250 | process_parent | def process_parent():
run = wandb.init()
assert run == wandb.run
run.log({"s1": 11})
run.config.c1 = 11
run.log({"s1": 4}, step=4, commit=False) | python | tests/functional_tests/t0_main/mp/06-3-share-child-lt-step.py | 30 | 35 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
251 | share_run | def share_run():
process_parent()
# Start a new run in parallel in a child process
p = mp.Process(target=process_child, kwargs=dict(run=wandb.run, check_warning=True))
p.start()
p.join()
wandb.finish() | python | tests/functional_tests/t0_main/mp/06-3-share-child-lt-step.py | 38 | 44 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
252 | reference_run | def reference_run():
process_parent()
process_child(wandb.run)
wandb.finish() | python | tests/functional_tests/t0_main/mp/06-3-share-child-lt-step.py | 47 | 50 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
253 | main | def main():
wandb.require("service")
reference_run()
share_run() | python | tests/functional_tests/t0_main/mp/06-3-share-child-lt-step.py | 53 | 58 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
254 | f | def f(run, x):
# with wandb.init() as run:
run.config.x = x
run.define_metric(f"step_{x}")
for i in range(3):
# Log metrics with wandb
run.log({f"i_{x}": i * x, f"step_{x}": i})
return sqrt(x) | python | tests/functional_tests/t0_main/mp/21-2-joblib-parallel-share-run.py | 10 | 17 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
255 | main | def main():
run = wandb.init()
res = Parallel(n_jobs=2)(delayed(f)(run, i**2) for i in range(4))
print(res) | python | tests/functional_tests/t0_main/mp/21-2-joblib-parallel-share-run.py | 20 | 23 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
256 | worker | def worker(initial: int):
with wandb.init(project="tester222", config={"init": initial}) as run:
for i in range(3):
run.log({"i": initial + i}) | python | tests/functional_tests/t0_main/mp/20-2-thread-pool-executor.py | 13 | 16 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
257 | main | def main():
mp.set_start_method("spawn")
wandb.require("service")
with ThreadPoolExecutor(max_workers=4) as e:
e.map(worker, [12, 2, 40, 17]) | python | tests/functional_tests/t0_main/mp/20-2-thread-pool-executor.py | 19 | 23 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
258 | process_child | def process_child(n: int, main_q: mp.Queue, proc_q: mp.Queue):
print(f"init:{n}")
run = wandb.init(config=dict(id=n))
# let main know we have called init
main_q.put(n)
proc_q.get()
run.log({"data": n})
# let main know we have called log
main_q.put(n)
proc_q.get()
if n == 2:
... | python | tests/functional_tests/t0_main/mp/18-multiple-crash.py | 25 | 49 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
259 | main_sync | def main_sync(workers: List):
for _, mq, _ in workers:
mq.get()
for _, _, pq in workers:
pq.put(None) | python | tests/functional_tests/t0_main/mp/18-multiple-crash.py | 52 | 56 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
260 | main | def main():
wandb.require("service")
wandb.setup()
workers = []
for n in range(4):
main_q = mp.Queue()
proc_q = mp.Queue()
p = mp.Process(
target=process_child, kwargs=dict(n=n, main_q=main_q, proc_q=proc_q)
)
workers.append((p, main_q, proc_q))
... | python | tests/functional_tests/t0_main/mp/18-multiple-crash.py | 59 | 87 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
261 | do_run | def do_run(num):
run = wandb.init()
run.config.id = num
run.log(dict(s=num))
return num | python | tests/functional_tests/t0_main/mp/05-pool-nofinish.py | 10 | 14 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
262 | main | def main():
wandb.require("service")
wandb.setup()
num_proc = 4
pool = mp.Pool(processes=num_proc)
result = pool.map_async(do_run, range(num_proc))
data = result.get(60)
print(f"DEBUG: {data}")
assert len(data) == 4 | python | tests/functional_tests/t0_main/mp/05-pool-nofinish.py | 17 | 26 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
263 | process_child | def process_child():
run_child = wandb.init()
run_child.config.id = "child"
run_child.name = "child-name"
fname = os.path.join("tmp", "03-child.txt")
with open(fname, "w") as fp:
fp.write("child-data")
run_child.save(fname)
run_child.log({"c1": 21})
run_child.log({"c1": 22})
... | python | tests/functional_tests/t0_main/mp/03-parent-child.py | 11 | 23 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
264 | main | def main():
wandb.require("service")
try:
os.mkdir("tmp")
except FileExistsError:
pass
run_parent = wandb.init()
run_parent.config.id = "parent"
run_parent.log({"p1": 11})
run_parent.name = "parent-name"
fname1 = os.path.join("tmp", "03-parent-1.txt")
with open(fna... | python | tests/functional_tests/t0_main/mp/03-parent-child.py | 26 | 61 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
265 | f | def f(x):
with wandb.init() as run:
run.config.x = x
for i in range(3):
# Log metrics with wandb
run.log({"i": i * x})
return sqrt(x) | python | tests/functional_tests/t0_main/mp/21-1-joblib-parallel.py | 10 | 16 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
266 | main | def main():
res = Parallel(n_jobs=2)(delayed(f)(i**2) for i in range(4))
print(res) | python | tests/functional_tests/t0_main/mp/21-1-joblib-parallel.py | 19 | 21 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
267 | get_dataset | def get_dataset(self, dataset):
# load sample dataset in JSON format
file_name = dataset + ".json"
with open("prodigy_test_resources/" + file_name) as f:
data = json.load(f)
return data
return [] | python | tests/functional_tests/t0_main/prodigy/prodigy_connect.py | 8 | 14 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
268 | connect | def connect(self):
# initialize sample database
database = Database()
return database | python | tests/functional_tests/t0_main/prodigy/prodigy_connect.py | 18 | 21 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
269 | test_profiler | def test_profiler():
"""Simulate a typical use-case for PyTorch Profiler: training performance.
Generate random noise and train a simple conv net on this noise using the torch
profiler api. Doing so dumps a "pt.trace.json" file in the given logdir. This test
then ensures that these trace files are sent... | python | tests/functional_tests/t0_main/profiler/profiler.py | 8 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
270 | random_batch_generator | def random_batch_generator():
for i in range(10):
# create 1-sized batches of 28x28 random noise (simulating images)
yield i, (torch.randn((1, 1, 28, 28)), torch.randint(0, 10, (1,))) | python | tests/functional_tests/t0_main/profiler/profiler.py | 16 | 19 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
271 | __init__ | def __init__(self):
super().__init__()
self.conv1 = torch.nn.Conv2d(1, 32, 3, 1)
self.conv2 = torch.nn.Conv2d(32, 64, 3, 1)
self.fc1 = torch.nn.Linear(9216, 128)
self.fc2 = torch.nn.Linear(128, 10) | python | tests/functional_tests/t0_main/profiler/profiler.py | 22 | 27 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
272 | forward | def forward(self, x):
x = relu(self.conv1(x))
x = relu(self.conv2(x))
x = max_pool2d(x, 2)
x = torch.flatten(x, 1)
x = relu(self.fc1(x))
x = self.fc2(x)
output = log_softmax(x, dim=1)
return output | python | tests/functional_tests/t0_main/profiler/profiler.py | 29 | 37 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
273 | train | def train(data):
inputs, labels = data[0], data[1]
outputs = model(inputs)
loss = criterion(outputs, labels)
optimizer.zero_grad()
loss.backward()
optimizer.step() | python | tests/functional_tests/t0_main/profiler/profiler.py | 44 | 50 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
274 | start | def start(self):
self.raw_df = pd.read_csv(self.raw_data)
self.next(self.split_data) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decostep.py | 30 | 32 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
275 | split_data | def split_data(self):
X = self.raw_df.drop("Wine", axis=1)
y = self.raw_df[["Wine"]]
self.X_train, self.X_test, self.y_train, self.y_test = train_test_split(
X, y, test_size=self.test_size, random_state=self.seed
)
self.next(self.train) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decostep.py | 36 | 42 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
276 | train | def train(self):
self.clf = RandomForestClassifier(random_state=self.seed)
self.clf.fit(self.X_train, self.y_train)
self.next(self.end) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decostep.py | 46 | 49 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
277 | end | def end(self):
self.preds = self.clf.predict(self.X_test)
self.accuracy = accuracy_score(self.y_test, self.preds) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decostep.py | 53 | 55 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
278 | start | def start(self):
self.use_cuda = not self.no_cuda and torch.cuda.is_available()
torch.manual_seed(self.seed)
self.train_kwargs = {"batch_size": self.batch_size}
self.test_kwargs = {"batch_size": self.test_batch_size}
if self.use_cuda:
self.cuda_kwargs = {"num_worker... | python | tests/functional_tests/t0_main/metaflow/wandb-pytorch-flow.py | 37 | 50 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
279 | setup_data | def setup_data(self):
transform = transforms.Compose(
[transforms.ToTensor(), transforms.Normalize((0.1307,), (0.3081,))]
)
self.dataset1 = datasets.FakeData(
size=2000, image_size=(1, 28, 28), num_classes=10, transform=transform
)
self.dataset2 = datasets... | python | tests/functional_tests/t0_main/metaflow/wandb-pytorch-flow.py | 54 | 64 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
280 | setup_dataloaders | def setup_dataloaders(self):
self.train_loader = torch.utils.data.DataLoader(
self.dataset1, **self.train_kwargs
)
self.test_loader = torch.utils.data.DataLoader(
self.dataset2, **self.test_kwargs
)
self.next(self.train_model) | python | tests/functional_tests/t0_main/metaflow/wandb-pytorch-flow.py | 67 | 74 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
281 | train_model | def train_model(self):
torch.manual_seed(self.seed)
device = torch.device("cuda" if self.use_cuda else "cpu")
self.model = Net()
self.model.to(device)
optimizer = optim.Adadelta(self.model.parameters(), lr=self.lr)
scheduler = StepLR(optimizer, step_size=1, gamma=self.g... | python | tests/functional_tests/t0_main/metaflow/wandb-pytorch-flow.py | 77 | 102 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
282 | end | def end(self):
pass | python | tests/functional_tests/t0_main/metaflow/wandb-pytorch-flow.py | 105 | 106 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
283 | __init__ | def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 32, 3, 1)
self.conv2 = nn.Conv2d(32, 64, 3, 1)
self.dropout1 = nn.Dropout(0.25)
self.dropout2 = nn.Dropout(0.5)
self.fc1 = nn.Linear(9216, 128)
self.fc2 = nn.Linear(128, 10) | python | tests/functional_tests/t0_main/metaflow/wandb-pytorch-flow.py | 113 | 120 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
284 | forward | def forward(self, x):
x = self.conv1(x)
x = F.relu(x)
x = self.conv2(x)
x = F.relu(x)
x = F.max_pool2d(x, 2)
x = self.dropout1(x)
x = torch.flatten(x, 1)
x = self.fc1(x)
x = F.relu(x)
x = self.dropout2(x)
x = self.fc2(x)
out... | python | tests/functional_tests/t0_main/metaflow/wandb-pytorch-flow.py | 122 | 135 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
285 | train | def train(model, device, train_loader, optimizer, epoch, log_interval, dry_run):
model.train()
for batch_idx, (data, target) in enumerate(train_loader):
data, target = data.to(device), target.to(device)
optimizer.zero_grad()
output = model(data)
loss = F.nll_loss(output, target)
... | python | tests/functional_tests/t0_main/metaflow/wandb-pytorch-flow.py | 138 | 152 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
286 | test | def test(model, device, test_loader):
model.eval()
test_loss = 0
correct = 0
with torch.no_grad():
for data, target in test_loader:
data, target = data.to(device), target.to(device)
output = model(data)
test_loss += F.nll_loss(
output, target, ... | python | tests/functional_tests/t0_main/metaflow/wandb-pytorch-flow.py | 155 | 172 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
287 | start | def start(self):
self.raw_df = pd.read_csv(self.raw_data)
self.next(self.split_data) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decoboth.py | 31 | 33 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
288 | split_data | def split_data(self):
X = self.raw_df.drop("Wine", axis=1)
y = self.raw_df[["Wine"]]
self.X_train, self.X_test, self.y_train, self.y_test = train_test_split(
X, y, test_size=self.test_size, random_state=self.seed
)
self.next(self.train) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decoboth.py | 37 | 43 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
289 | train | def train(self):
self.clf = RandomForestClassifier(random_state=self.seed)
self.clf.fit(self.X_train, self.y_train)
self.next(self.end) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decoboth.py | 46 | 49 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
290 | end | def end(self):
self.preds = self.clf.predict(self.X_test)
self.accuracy = accuracy_score(self.y_test, self.preds) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decoboth.py | 52 | 54 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
291 | start | def start(self):
self.raw_df = pd.read_csv(self.raw_data)
self.next(self.split_data) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decoclass.py | 30 | 32 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
292 | split_data | def split_data(self):
X = self.raw_df.drop("Wine", axis=1)
y = self.raw_df[["Wine"]]
self.X_train, self.X_test, self.y_train, self.y_test = train_test_split(
X, y, test_size=self.test_size, random_state=self.seed
)
self.next(self.train) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decoclass.py | 35 | 41 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
293 | train | def train(self):
self.clf = RandomForestClassifier(random_state=self.seed)
self.clf.fit(self.X_train, self.y_train)
self.next(self.end) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decoclass.py | 44 | 47 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
294 | end | def end(self):
self.preds = self.clf.predict(self.X_test)
self.accuracy = accuracy_score(self.y_test, self.preds) | python | tests/functional_tests/t0_main/metaflow/wandb-example-flow-decoclass.py | 50 | 52 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
295 | setup_model | def setup_model(name, *args, **kwargs):
return eval(name)(*args, **kwargs) | python | tests/functional_tests/t0_main/metaflow/wandb-foreach-flow.py | 21 | 22 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
296 | start | def start(self):
self.models = ["RandomForestClassifier", "GradientBoostingClassifier"]
self.raw_df = pd.read_csv(self.raw_data)
self.next(self.split_data) | python | tests/functional_tests/t0_main/metaflow/wandb-foreach-flow.py | 36 | 39 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
297 | split_data | def split_data(self):
X = self.raw_df.drop("Wine", axis=1)
y = self.raw_df[["Wine"]]
self.X_train, self.X_test, self.y_train, self.y_test = train_test_split(
X, y, test_size=self.test_size, random_state=self.seed
)
self.next(self.train, foreach="models") | python | tests/functional_tests/t0_main/metaflow/wandb-foreach-flow.py | 43 | 49 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
298 | train | def train(self):
self.model_name = self.input
# self.clf = RandomForestClassifier(random_state=self.seed)
self.clf = setup_model(self.model_name, random_state=self.seed)
self.clf.fit(self.X_train, self.y_train)
self.preds = self.clf.predict(self.X_test)
self.accuracy = ac... | python | tests/functional_tests/t0_main/metaflow/wandb-foreach-flow.py | 52 | 59 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
299 | join_train | def join_train(self, inputs):
self.results = [
{
"model_name": input.model_name,
"preds": input.preds,
"accuracy": input.accuracy,
}
for input in inputs
]
self.next(self.end) | python | tests/functional_tests/t0_main/metaflow/wandb-foreach-flow.py | 62 | 71 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
300 | end | def end(self):
pass | python | tests/functional_tests/t0_main/metaflow/wandb-foreach-flow.py | 74 | 75 | {
"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.