Added download script and updated management command
This commit is contained in:
parent
f69d9f3e1d
commit
29f97b383d
2 changed files with 32 additions and 4 deletions
|
|
@ -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.")
|
||||
self.stdout.write(self.style.SUCCESS(f"Successfully updated {users.count()} users."))
|
||||
25
download_model.py
Normal file
25
download_model.py
Normal file
|
|
@ -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()
|
||||
Loading…
Reference in a new issue