Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

history.py 551 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  1. import csv
  2. import os
  3. from wandb import util
  4. HISTORY_FNAME = 'wandb-history.json'
  5. class History(object):
  6. """Used to store data that changes over time during runs. """
  7. def __init__(self, out_dir='.'):
  8. self.out_fname = os.path.join(out_dir, HISTORY_FNAME)
  9. self.rows = []
  10. def _write(self):
  11. with open(self.out_fname, 'w') as f:
  12. s = util.json_dumps_safer(self.rows, indent=4)
  13. f.write(s)
  14. f.write('\n')
  15. def add(self, row):
  16. self.rows.append(row)
  17. self._write()
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...