Txu647 commited on
Commit
9e1bb06
·
1 Parent(s): c2f3dfc

fix: version compatibility and HF_TOKEN for private repo

Browse files
Files changed (2) hide show
  1. inference.py +8 -2
  2. requirements.txt +4 -4
inference.py CHANGED
@@ -45,12 +45,16 @@ def download_model_from_hf(
45
  """
46
  print(f"Downloading {filename} from HuggingFace Hub ({model_id})...")
47
 
 
 
 
48
  try:
49
  checkpoint_path = hf_hub_download(
50
  repo_id=model_id,
51
  filename=filename,
52
  local_dir=local_dir,
53
- force_download=force_download
 
54
  )
55
  print(f"Model downloaded to: {checkpoint_path}")
56
  return checkpoint_path
@@ -248,10 +252,12 @@ class CalligraphyGenerator:
248
 
249
  # Try to download from HF Hub
250
  print(f"Font file not found locally, downloading from HuggingFace Hub...")
 
251
  try:
252
  font_path = hf_hub_download(
253
  repo_id=HF_MODEL_ID,
254
- filename="FangZhengKaiTiFanTi-1.ttf"
 
255
  )
256
  print(f"Font downloaded to: {font_path}")
257
  return font_path
 
45
  """
46
  print(f"Downloading {filename} from HuggingFace Hub ({model_id})...")
47
 
48
+ # Get HF token from environment for private repos
49
+ hf_token = os.environ.get("HF_TOKEN", None)
50
+
51
  try:
52
  checkpoint_path = hf_hub_download(
53
  repo_id=model_id,
54
  filename=filename,
55
  local_dir=local_dir,
56
+ force_download=force_download,
57
+ token=hf_token
58
  )
59
  print(f"Model downloaded to: {checkpoint_path}")
60
  return checkpoint_path
 
252
 
253
  # Try to download from HF Hub
254
  print(f"Font file not found locally, downloading from HuggingFace Hub...")
255
+ hf_token = os.environ.get("HF_TOKEN", None)
256
  try:
257
  font_path = hf_hub_download(
258
  repo_id=HF_MODEL_ID,
259
+ filename="FangZhengKaiTiFanTi-1.ttf",
260
+ token=hf_token
261
  )
262
  print(f"Font downloaded to: {font_path}")
263
  return font_path
requirements.txt CHANGED
@@ -1,7 +1,7 @@
1
- accelerate
2
- einops
3
- transformers
4
- huggingface-hub
5
  optimum-quanto
6
  sentencepiece
7
  torch
 
1
+ accelerate>=0.30.0
2
+ einops>=0.8.0
3
+ transformers>=4.43.0
4
+ huggingface-hub>=0.24.0
5
  optimum-quanto
6
  sentencepiece
7
  torch