Skip to content

Commit c4bc3ca

Browse files
catch empty df error
1 parent aac3d1e commit c4bc3ca

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

code/logging_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pandas as pd
22
import os
3+
from pandas.errors import EmptyDataError
34

45

56
def update_loss_log(
@@ -9,7 +10,10 @@ def update_loss_log(
910
Update the loss logs with a single dataset loss value.
1011
"""
1112
if os.path.exists(log_file_path):
12-
loss_logs_df = pd.read_csv(log_file_path)
13+
try:
14+
loss_logs_df = pd.read_csv(log_file_path)
15+
except EmptyDataError:
16+
loss_logs_df = pd.DataFrame()
1317

1418
new_row = {
1519
"seed": seed,

0 commit comments

Comments
 (0)