Rausda6 commited on
Commit
517bde4
·
verified ·
1 Parent(s): 36c9228

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -20,12 +20,7 @@ from pathlib import Path
20
 
21
  model_subdir = Path.home() / ".cache" / "huggingface" / "hub" / "models--unsloth--Llama-3.2-3B"
22
 
23
- if model_subdir.exists():
24
- print(f"🧹 Deleting model cache at {model_subdir}")
25
- shutil.rmtree(model_subdir)
26
- print("✅ Model removed.")
27
- else:
28
- print("⚠️ Specified model not found in cache.")
29
 
30
  # Enable persistent caching on Hugging Face Spaces (if persistent storage is enabled)
31
  os.environ["TRANSFORMERS_CACHE"] = "/data/models"
@@ -41,8 +36,8 @@ MAX_FILE_SIZE_MB = 20
41
  MAX_FILE_SIZE_BYTES = MAX_FILE_SIZE_MB * 1024 * 1024
42
 
43
  MODEL_ID = "meta-llama/Meta-Llama-3-8B"# unsloth/Llama-3.2-3B"#meta-llama/Meta-Llama-3-8B" #"unsloth/Llama-4-Scout-17B-16E-Instruct-GGUF"# unsloth/Qwen2.5-1.5B" #unsloth/Llama-3.2-3B" #unsloth/Llama-3.2-1B"
44
- glotoken=Tokentest
45
- # Global logging system - CRITICAL FIX #1
46
  logs = []
47
 
48
  def add_log(message):
@@ -50,7 +45,7 @@ def add_log(message):
50
  logs.append(f"[{time.strftime('%H:%M:%S')}] {message}")
51
  print(message)
52
 
53
- # Initialize model with comprehensive error handling - CRITICAL FIX #2
54
  model = None
55
  tokenizer = None
56
  generation_config = None
 
20
 
21
  model_subdir = Path.home() / ".cache" / "huggingface" / "hub" / "models--unsloth--Llama-3.2-3B"
22
 
23
+
 
 
 
 
 
24
 
25
  # Enable persistent caching on Hugging Face Spaces (if persistent storage is enabled)
26
  os.environ["TRANSFORMERS_CACHE"] = "/data/models"
 
36
  MAX_FILE_SIZE_BYTES = MAX_FILE_SIZE_MB * 1024 * 1024
37
 
38
  MODEL_ID = "meta-llama/Meta-Llama-3-8B"# unsloth/Llama-3.2-3B"#meta-llama/Meta-Llama-3-8B" #"unsloth/Llama-4-Scout-17B-16E-Instruct-GGUF"# unsloth/Qwen2.5-1.5B" #unsloth/Llama-3.2-3B" #unsloth/Llama-3.2-1B"
39
+ glotoken = os.environ.get("Tokentest")
40
+ # Global logging system -
41
  logs = []
42
 
43
  def add_log(message):
 
45
  logs.append(f"[{time.strftime('%H:%M:%S')}] {message}")
46
  print(message)
47
 
48
+ # Initialize model with comprehensive error handling
49
  model = None
50
  tokenizer = None
51
  generation_config = None