Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]init trainer log #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

littletomatodonkey
Copy link
Contributor

@littletomatodonkey littletomatodonkey commented Dec 4, 2021

att, the log will also be saved into os.path.join(save_path, "train.log")

  • usage
import time
import auto_log
from auto_log import TrainerLogger

logger = TrainerLogger("./output")

logger.add_record_info("acc")

run_cost = time.time()
reader_cost = time.time()
loss = 0.0
for idx in range(100):
    time.sleep(0.001)
    reader_cost = time.time() - reader_cost
    run_cost = time.time()
    time.sleep(0.01)
    loss = (100 - idx) * 0.01
    run_cost = time.time() - run_cost
    
    logger.update(
        32,
        reader_cost,
        run_cost,
        loss,
        acc = idx * 0.1,
    )
    if idx % 10 == 0:
        logger.log(0, idx)
    
    reader_cost = time.time()
    
logger.log(0)
  • output
[2021/12/04 05:16:12] root INFO: [epoch 0, batch_idx 0][TRAIN]avg_samples: 32.0 , avg_reader_cost: 0.0010657 sec, avg_batch_cost: 0.0111225 sec, loss: 1.0000000 , acc: 0.0000000 , avg_ips: 2877.0600416 images/sec
[2021/12/04 05:16:12] root INFO: [epoch 0, batch_idx 0][TRAIN]avg_samples: 32.0 , avg_reader_cost: 0.0010534 sec, avg_batch_cost: 0.0111082 sec, loss: 0.9450000 , acc: 0.5500000 , avg_ips: 2880.7589432 images/sec
[2021/12/04 05:16:12] root INFO: [epoch 0, batch_idx 0][TRAIN]avg_samples: 32.0 , avg_reader_cost: 0.0010544 sec, avg_batch_cost: 0.0111082 sec, loss: 0.8450000 , acc: 1.5500000 , avg_ips: 2880.7651263 images/sec
[2021/12/04 05:16:12] root INFO: [epoch 0, batch_idx 0][TRAIN]avg_samples: 32.0 , avg_reader_cost: 0.0010545 sec, avg_batch_cost: 0.0111093 sec, loss: 0.7450000 , acc: 2.5500000 , avg_ips: 2880.4807321 images/sec
[2021/12/04 05:16:12] root INFO: [epoch 0, batch_idx 0][TRAIN]avg_samples: 32.0 , avg_reader_cost: 0.0010543 sec, avg_batch_cost: 0.0111051 sec, loss: 0.6450000 , acc: 3.5500000 , avg_ips: 2881.5567798 images/sec
[2021/12/04 05:16:13] root INFO: [epoch 0, batch_idx 0][TRAIN]avg_samples: 32.0 , avg_reader_cost: 0.0010532 sec, avg_batch_cost: 0.0111079 sec, loss: 0.5450000 , acc: 4.5500000 , avg_ips: 2880.8331419 images/sec
[2021/12/04 05:16:13] root INFO: [epoch 0, batch_idx 0][TRAIN]avg_samples: 32.0 , avg_reader_cost: 0.0010535 sec, avg_batch_cost: 0.0111083 sec, loss: 0.4450000 , acc: 5.5500000 , avg_ips: 2880.7403941 images/sec
[2021/12/04 05:16:13] root INFO: [epoch 0, batch_idx 0][TRAIN]avg_samples: 32.0 , avg_reader_cost: 0.0010543 sec, avg_batch_cost: 0.0111100 sec, loss: 0.3450000 , acc: 6.5500000 , avg_ips: 2880.2952878 images/sec
[2021/12/04 05:16:13] root INFO: [epoch 0, batch_idx 0][TRAIN]avg_samples: 32.0 , avg_reader_cost: 0.0010542 sec, avg_batch_cost: 0.0111101 sec, loss: 0.2450000 , acc: 7.5500000 , avg_ips: 2880.2582019 images/sec
[2021/12/04 05:16:13] root INFO: [epoch 0, batch_idx 0][TRAIN]avg_samples: 32.0 , avg_reader_cost: 0.0010561 sec, avg_batch_cost: 0.0111109 sec, loss: 0.1450000 , acc: 8.5500000 , avg_ips: 2880.0604261 images/sec
[2021/12/04 05:16:13] root INFO: [end of epoch 0][TRAIN]avg_samples: 32.0 , avg_reader_cost: 0.0010601 sec, avg_batch_cost: 0.0111144 sec, loss: 0.5050000 , acc: 4.9500000 , avg_ips: 2879.1405077 images/sec

@littletomatodonkey littletomatodonkey changed the title init trainer log [WIP]init trainer log Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant