Marcin-XStudio commited on
Commit
702a77b
·
1 Parent(s): 84a9640

push model cash path

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -29,7 +29,7 @@ model_cache_path = snapshot_download(
29
  local_dir="/app/model_cache" # <-- direct destination
30
  )
31
 
32
- print(">>> MODEL CACHE PATH:", MODEL_PATH, os.listdir(MODEL_PATH))
33
 
34
  device = "gpu" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
35
  dtype = torch.float16 if device in ("mps", "gpu") else torch.float32
@@ -50,18 +50,18 @@ def load_model():
50
  # model_name, torch_dtype=dtype, trust_remote_code=True
51
  # )
52
  model = AutoModelForCausalLM.from_pretrained(
53
- MODEL_PATH,
54
  local_files_only=True,
55
  torch_dtype=dtype,
56
  trust_remote_code=True
57
  ).to(device).eval()
58
  # tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
59
  tokenizer = AutoTokenizer.from_pretrained(
60
- MODEL_PATH,
61
  local_files_only=True,
62
  trust_remote_code=True
63
  )
64
- print("✅ Model and tokenizer loaded from", MODEL_PATH)
65
 
66
  def predict_NuExtract(texts, template, batch_size=10, max_length=5096, max_new_tokens=1024):
67
  print("Starting NuExtract prediction...", flush=True)
 
29
  local_dir="/app/model_cache" # <-- direct destination
30
  )
31
 
32
+ print(">>> MODEL CACHE PATH:", model_cache_path, os.listdir(model_cache_path))
33
 
34
  device = "gpu" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
35
  dtype = torch.float16 if device in ("mps", "gpu") else torch.float32
 
50
  # model_name, torch_dtype=dtype, trust_remote_code=True
51
  # )
52
  model = AutoModelForCausalLM.from_pretrained(
53
+ model_cache_path,
54
  local_files_only=True,
55
  torch_dtype=dtype,
56
  trust_remote_code=True
57
  ).to(device).eval()
58
  # tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
59
  tokenizer = AutoTokenizer.from_pretrained(
60
+ model_cache_path,
61
  local_files_only=True,
62
  trust_remote_code=True
63
  )
64
+ print("✅ Model and tokenizer loaded from", model_cache_path)
65
 
66
  def predict_NuExtract(texts, template, batch_size=10, max_length=5096, max_new_tokens=1024):
67
  print("Starting NuExtract prediction...", flush=True)