Skip to content

Commit

Permalink
Fix failing clean_skops.py script (skops-dev#407)
Browse files Browse the repository at this point in the history
Return type from client.model_info.lastModified is now a tz-aware
datetime object.
  • Loading branch information
BenjaminBossan authored Jan 5, 2024
1 parent 70d7335 commit bed8339
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions scripts/clean_skops.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@
# https://github.com/huggingface/moon-landing/issues/6034
continue

age = (
datetime.datetime.now()
- datetime.datetime.fromisoformat(info.lastModified.rsplit(".", 1)[0])
).days
if age < MAX_AGE:
now = datetime.datetime.now(info.lastModified.tzinfo)
age = now - info.lastModified
if age.days < MAX_AGE:
print(f"Skipping model: {model_info.modelId}, age: {age}")
continue
print(f"deleting {model_info.modelId}, age: {age} days")
Expand All @@ -56,11 +54,9 @@
# https://github.com/huggingface/moon-landing/issues/6034
continue

age = (
datetime.datetime.now()
- datetime.datetime.fromisoformat(info.lastModified.rsplit(".", 1)[0])
).days
if age < MAX_AGE:
now = datetime.datetime.now(info.lastModified.tzinfo)
age = now - info.lastModified
if age.days < MAX_AGE:
print(f"Skipping space: {space_info.id}, age: {age}")
continue
print(f"deleting {space_info.id}, age: {age} days")
Expand Down

0 comments on commit bed8339

Please sign in to comment.