From d1d6f8f9e8078a6e1544596d48bf1559291bc8fd Mon Sep 17 00:00:00 2001 From: Zirui Cai <74649535+Feudalman@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:39:15 +0800 Subject: [PATCH] test: text log --- test/create_experiment.py | 54 +++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/test/create_experiment.py b/test/create_experiment.py index 77027132..933dab2c 100644 --- a/test/create_experiment.py +++ b/test/create_experiment.py @@ -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)