Skip to content

[ADVICE] log改为异步执行? #810

@Zeyi-Lin

Description

@Zeyi-Lin

🤪 Features description [Please make everyone to understand it]

有用户群里反馈,在指标数大于600时,在服务器上执行首个step的log要30s,之后每个step的log要3s,非常影响训练时间;而使用wandb没有这个问题,所以可能需要考虑log使用异步执行,或找到性能瓶颈在哪里。

测试代码:

import swanlab
import time
import jax

swanlab.init(project="dev", mode="local")

data = {f'key_abcdefghijklmnopqrst_{i}': jax.numpy.array(i * 1.5) for i in range(600)}
print(data)

total_start = time.time()
for i in range(100):
    epoch_start = time.time()
    swanlab.log(data)
    epoch_end = time.time()
    print(f"Epoch {i+1}/100 took {epoch_end - epoch_start:.2f} seconds")

total_end = time.time()
print(f"Total time taken: {total_end - total_start:.2f} seconds")

👍 What problem does this feature solve

降低swanlab.log带来的训练时间影响

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions