Skip to content

Commit

Permalink
List untracked models from disk
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Oct 1, 2024
1 parent efb169d commit 9fc93cd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions r2ai/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,20 @@ def list_downloaded_models():
print(f" {size}G {M}")
except Exception as e:
print(f" ??? {M}")
user_data_dir = appdirs.user_data_dir("r2ai")
models_path = os.path.join(user_data_dir, "models")
files = os.listdir(models_path)
for file in files:
found = False
for m in usermodels:
last_part = usermodels[m].split("/")[-1]
if last_part == file:
found = True
if not found:
M = f"{models_path}/{file}"
size = round(os.path.getsize(M) / 1024 / 1024 / 1024, 2)
size = f"{size}".rjust(6)
print(f" {size}G {M}")
except Exception as e:
print(e)
return None
Expand Down

0 comments on commit 9fc93cd

Please sign in to comment.