david167 commited on
Commit
444b4d9
·
1 Parent(s): de72460

Fix XetHub issue: use Meta-Llama-3.1-8B-Instruct (official HF storage)

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. app.py +4 -8
Dockerfile CHANGED
@@ -38,7 +38,7 @@ COPY README.md .
38
  RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
39
  ENV HF_HOME=/app/.cache
40
  ENV HF_DATASETS_CACHE=/app/.cache
41
- ENV OMP_NUM_THREADS=1
42
 
43
  # Expose port
44
  EXPOSE 7860
 
38
  RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
39
  ENV HF_HOME=/app/.cache
40
  ENV HF_DATASETS_CACHE=/app/.cache
41
+ ENV OMP_NUM_THREADS=4
42
 
43
  # Expose port
44
  EXPOSE 7860
app.py CHANGED
@@ -52,9 +52,7 @@ async def load_model_with_retry(model_name: str, hf_token: str, max_retries: int
52
  model_name,
53
  use_fast=True,
54
  trust_remote_code=True,
55
- token=hf_token,
56
- resume_download=True, # Resume interrupted downloads
57
- force_download=False # Use cache if available
58
  )
59
 
60
  model = AutoModelForCausalLM.from_pretrained(
@@ -64,9 +62,7 @@ async def load_model_with_retry(model_name: str, hf_token: str, max_retries: int
64
  trust_remote_code=True,
65
  low_cpu_mem_usage=True,
66
  use_safetensors=True, # Force safetensors to avoid CVE-2025-32434
67
- token=hf_token,
68
- resume_download=True, # Resume interrupted downloads
69
- force_download=False # Use cache if available
70
  )
71
 
72
  return tokenizer, model
@@ -105,8 +101,8 @@ async def load_model():
105
  try:
106
  logger.info("Loading model with transformers...")
107
 
108
- # Use Llama 3.1 8B Instruct (user now has access)
109
- base_model_name = "meta-llama/Llama-3.1-8B-Instruct"
110
 
111
  tokenizer, model = await load_model_with_retry(base_model_name, hf_token)
112
 
 
52
  model_name,
53
  use_fast=True,
54
  trust_remote_code=True,
55
+ token=hf_token
 
 
56
  )
57
 
58
  model = AutoModelForCausalLM.from_pretrained(
 
62
  trust_remote_code=True,
63
  low_cpu_mem_usage=True,
64
  use_safetensors=True, # Force safetensors to avoid CVE-2025-32434
65
+ token=hf_token
 
 
66
  )
67
 
68
  return tokenizer, model
 
101
  try:
102
  logger.info("Loading model with transformers...")
103
 
104
+ # Use Llama 3.1 8B Instruct from official HF storage (not XetHub)
105
+ base_model_name = "meta-llama/Meta-Llama-3.1-8B-Instruct"
106
 
107
  tokenizer, model = await load_model_with_retry(base_model_name, hf_token)
108