Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions swanlab/data/porter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,16 @@ def backup():
def wrapper(wrapped, instance, args, kwargs):
result: Union[List[BaseModel], BaseModel] = wrapped(*args, **kwargs)
if result is not None:
f = getattr(instance, "_f")
if isinstance(result, list):
[f.write(item.to_record()) for item in result]
else:
f.write(result.to_record())
try:
f = getattr(instance, "_f")
if isinstance(result, list):
[f.write(item.to_record()) for item in result]
else:
f.write(result.to_record())
except ValueError:
# 写入备份文件失败,可能是因为没有开启备份模式或者备份文件未打开
# TODO: 记录本地日志
pass
return result

return wrapper
Expand Down
1 change: 1 addition & 0 deletions swanlab/data/run/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def _():
def cancel(self):
if self.timer is not None:
self.timer.cancel()
self.timer.join()

@property
def sleep_time(self):
Expand Down
2 changes: 1 addition & 1 deletion swanlab/data/run/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(
# 定时采集系统信息
# 测试时不开启此功能
# resume时不开启此功能
if "PYTEST_VERSION" not in os.environ or run_store.resume == 'never':
if "PYTEST_VERSION" not in os.environ and run_store.resume == 'never':
if monitor_funcs is not None and len(monitor_funcs) != 0:
swanlog.debug("Monitor on.")

Expand Down
2 changes: 1 addition & 1 deletion test/unit/sync/v0/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_sync():
record_logs: List[str] = []
# ---------------------------------- 开启实验 ----------------------------------
config = {
"epochs": 10,
"epochs": 10000,
"learning_rate": 0.01,
"offset": random.random() / 5,
}
Expand Down
Loading