|
34 | 34 | from diskcache import Cache
|
35 | 35 | from h2o_wave import Choice, Q, ui
|
36 | 36 | from pandas.core.frame import DataFrame
|
| 37 | +from sqlitedict import SqliteDict |
37 | 38 |
|
38 | 39 | from llm_studio.app_utils.db import Experiment
|
39 | 40 | from llm_studio.python_configs.base import DefaultConfigProblemBase
|
@@ -1643,9 +1644,21 @@ def get_experiments_info(df: DataFrame, q: Q) -> defaultdict:
|
1643 | 1644 | loss_function = ""
|
1644 | 1645 |
|
1645 | 1646 | charts_db_path = os.path.join(row.path, "charts_cache")
|
| 1647 | + old_db_path = os.path.join(row.path, "charts.db") |
1646 | 1648 | if os.path.exists(charts_db_path):
|
1647 | 1649 | with Cache(charts_db_path) as cache:
|
1648 | 1650 | logs = {key: cache.get(key) for key in cache}
|
| 1651 | + |
| 1652 | + if not logs and os.path.exists(old_db_path): |
| 1653 | + # migrate the old DB over to the new diskcache, should only need to be run once |
| 1654 | + # we could delete the old charts.db, but we don't want to risk the user stopping |
| 1655 | + # the service during the migration and therefore causing permanent data loss |
| 1656 | + with SqliteDict(old_db_path) as sqlite_logs: |
| 1657 | + keys = list(sqlite_logs.iterkeys()) |
| 1658 | + for key in keys: |
| 1659 | + cache.add(key, sqlite_logs[key]) |
| 1660 | + logs = {key: cache.get(key) for key in cache} |
| 1661 | + |
1649 | 1662 | if "internal" in logs.keys():
|
1650 | 1663 | if "current_step" in logs["internal"].keys():
|
1651 | 1664 | curr_step = int(logs["internal"]["current_step"]["values"][-1])
|
|
0 commit comments