B4869 commited on
Commit
102b8e2
·
1 Parent(s): 3dc2abf

bug fix again

Browse files
Files changed (1) hide show
  1. download_model.py +11 -0
download_model.py CHANGED
@@ -2,8 +2,19 @@
2
  Script สำหรับ download model ล่วงหน้าตอน Docker build
3
  เพื่อ cache model ไว้ใน Docker image
4
  """
 
 
5
  from sentence_transformers import SentenceTransformer
6
 
 
 
 
 
 
 
 
 
 
7
  print("Downloading model...")
8
  model = SentenceTransformer("google/embeddinggemma-300m")
9
  print("Model downloaded and cached successfully!")
 
2
  Script สำหรับ download model ล่วงหน้าตอน Docker build
3
  เพื่อ cache model ไว้ใน Docker image
4
  """
5
+ import os
6
+ from huggingface_hub import login
7
  from sentence_transformers import SentenceTransformer
8
 
9
+ # Login ด้วย HF_TOKEN จาก environment variable
10
+ token = os.getenv("HF_TOKEN")
11
+ if token:
12
+ login(token=token)
13
+ print("✅ Successfully authenticated with Hugging Face")
14
+ else:
15
+ print("⚠️ Warning: HF_TOKEN not found, trying without authentication")
16
+
17
+ # Download model
18
  print("Downloading model...")
19
  model = SentenceTransformer("google/embeddinggemma-300m")
20
  print("Model downloaded and cached successfully!")