Skip to content

Commit

Permalink
test: text log
Browse files Browse the repository at this point in the history
  • Loading branch information
Feudalman committed Feb 22, 2024
1 parent c75c942 commit d1d6f8f
Showing 1 changed file with 32 additions and 22 deletions.
54 changes: 32 additions & 22 deletions test/create_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,38 @@
logggings=True,
)
for epoch in range(2, epochs):
if epoch % 10 == 0:
# # 测试audio
# sample_rate = 44100
# test_audio_arr = np.random.randn(2, 100000)
# swanlab.log(
# {
# "test/audio": [swanlab.Audio(test_audio_arr, sample_rate, caption="test")] * (epoch // 10),
# },
# step=epoch,
# )
# 测试image
test_image = np.random.randint(0, 255, (100, 100, 3))
swanlab.log(
{
# "test/image": swanlab.Image(test_image, caption="test"),
"test/text": swanlab.Text("this is a test text", caption="test"),
},
step=epoch,
)
acc = 1 - 2**-epoch - random.random() / epoch - offset
loss = 2**-epoch + random.random() / epoch + offset
loss2 = 3**-epoch + random.random() / epoch + offset * 3
# if epoch % 10 == 0:
# # 测试audio
# sample_rate = 44100
# test_audio_arr = np.random.randn(2, 100000)
# swanlab.log(
# {
# "test/audio": [swanlab.Audio(test_audio_arr, sample_rate, caption="test")] * (epoch // 10),
# },
# step=epoch,
# )
# 测试image
# test_image = np.random.randint(0, 255, (100, 100, 3))
# swanlab.log(
# {
# # "test/image": swanlab.Image(test_image, caption="test"),
# "test/text": swanlab.Text("this is a test text", caption="test"),
# },
# step=epoch,
# )
# acc = 1 - 2**-epoch - random.random() / epoch - offset
# loss = 2**-epoch + random.random() / epoch + offset
# loss2 = 3**-epoch + random.random() / epoch + offset * 3
swanlab.log(
{
# "test/image": swanlab.Image(test_image, caption="test"),
"test/text": swanlab.Text(
"test test test test test test test test test test test test test test test",
caption="test test test test test test test test test test test test test test test",
),
},
step=epoch,
)
# print(f"epoch={epoch}, accuracy={acc}, loss={loss}")
# swanlab.log({"t/accuracy": acc, "loss": loss, "loss2": loss2})
time.sleep(2)

0 comments on commit d1d6f8f

Please sign in to comment.