Skip to content

Commit

Permalink
Don't crash if model download percentage update fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
dadmobile committed Dec 19, 2024
1 parent 2401268 commit ccb58bf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions transformerlab/shared/download_huggingface_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,13 @@ def check_disk_size(model_is_downloaded: Event):

db = sqlite3.connect(
f"{WORKSPACE_DIR}/llmlab.sqlite3", isolation_level=None)
db.execute(
"UPDATE job SET job_data=json_set(job_data, '$.downloaded', ?), progress=? WHERE id=?", (cache_size_growth, progress, job_id))
try:
db.execute(
"UPDATE job SET job_data=json_set(job_data, '$.downloaded', ?), progress=? WHERE id=?", (cache_size_growth, progress, job_id))
except sqlite3.OperationalError:
# Bit of a hack: We were having DB lock errors and this update isn't crucial
# So for now just skip if something goes wrong.
print(f"Failed to update download progress in DB ({progress}%). Skipping.")
db.close()

print(f"flag: {model_is_downloaded.is_set()}")
Expand Down

0 comments on commit ccb58bf

Please sign in to comment.