From 29f97b383d209f340bc5f1bbe526c942976a1a2e Mon Sep 17 00:00:00 2001 From: Viswamedha Nalabotu Date: Thu, 26 Feb 2026 11:38:04 +0000 Subject: [PATCH] Added download script and updated management command --- .../management/commands/reset_passwords.py | 11 +++++--- download_model.py | 25 +++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 download_model.py diff --git a/apps/accounts/management/commands/reset_passwords.py b/apps/accounts/management/commands/reset_passwords.py index fb4c0b4..9a54dff 100644 --- a/apps/accounts/management/commands/reset_passwords.py +++ b/apps/accounts/management/commands/reset_passwords.py @@ -1,14 +1,17 @@ from django.core.management.base import BaseCommand -from accounts.models import User +from django.contrib.auth import get_user_model + +User = get_user_model() class Command(BaseCommand): - help = 'Resets non-admin account passwords to "password" and admin account passwords to "admin" using the current SECRET_KEY' + help = 'Resets non-admin account passwords to "password" and admin account passwords to "admin"' def handle(self, *args, **kwargs): - for user in User.objects.all(): + users = User.objects.all() + for user in users: if user.is_staff: user.set_password('admin') else: user.set_password('password') user.save() - self.stdout.write("All account passwords synchronized with local SECRET_KEY.") \ No newline at end of file + self.stdout.write(self.style.SUCCESS(f"Successfully updated {users.count()} users.")) \ No newline at end of file diff --git a/download_model.py b/download_model.py new file mode 100644 index 0000000..143468a --- /dev/null +++ b/download_model.py @@ -0,0 +1,25 @@ +import os +from huggingface_hub import hf_hub_download + +REPO_ID = "Bartowski/Meta-Llama-3.1-8B-Instruct-GGUF" +FILENAME = "Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf" +LOCAL_DIR = "models" + +def download_model(): + print(f"🚀 Starting download of {FILENAME}...") + print(f"📂 Destination: {os.path.abspath(LOCAL_DIR)}") + + try: + path = hf_hub_download( + repo_id=REPO_ID, + filename=FILENAME, + local_dir=LOCAL_DIR, + ) + print(f"Model downloaded to: {path}") + print(f"Expected size: ~4.92 GB") + except Exception as e: + print(f"Error downloading model: {e}") + +if __name__ == "__main__": + os.makedirs(LOCAL_DIR, exist_ok=True) + download_model() \ No newline at end of file