ASTERIZER commited on
Commit
5848283
·
verified ·
1 Parent(s): ec8d28a

Upload upload_lora_to_hf.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. upload_lora_to_hf.py +11 -5
upload_lora_to_hf.py CHANGED
@@ -8,8 +8,8 @@ from huggingface_hub import HfApi
8
  def parse_args():
9
  parser = argparse.ArgumentParser(description="Upload a LoRA adapter folder to a Hugging Face model repo")
10
  parser.add_argument("--repo-id", default="ASTERIZER/LUNA-100M")
11
- parser.add_argument("--folder", default="Base/out/sft/rag_mcp_lora/final")
12
- parser.add_argument("--path-in-repo", default="rag_mcp_lora/final")
13
  parser.add_argument("--private", action="store_true")
14
  return parser.parse_args()
15
 
@@ -26,9 +26,15 @@ def main():
26
  if not folder.is_dir():
27
  raise NotADirectoryError(f"Expected a folder, got: {folder}")
28
 
29
- required_files = [folder / "adapter_model.pt", folder / "adapter_bundle.pt"]
30
- missing = [str(path) for path in required_files if not path.exists()]
31
- if missing:
 
 
 
 
 
 
32
  raise FileNotFoundError(f"Missing expected adapter files: {', '.join(missing)}")
33
 
34
  api = HfApi(token=token)
 
8
  def parse_args():
9
  parser = argparse.ArgumentParser(description="Upload a LoRA adapter folder to a Hugging Face model repo")
10
  parser.add_argument("--repo-id", default="ASTERIZER/LUNA-100M")
11
+ parser.add_argument("--folder", default="Base/out/sft/rag_mcp_lora")
12
+ parser.add_argument("--path-in-repo", default="rag_mcp_lora")
13
  parser.add_argument("--private", action="store_true")
14
  return parser.parse_args()
15
 
 
26
  if not folder.is_dir():
27
  raise NotADirectoryError(f"Expected a folder, got: {folder}")
28
 
29
+ candidate_files = [
30
+ folder / "adapter_model.pt",
31
+ folder / "adapter_bundle.pt",
32
+ folder / "final" / "adapter_model.pt",
33
+ folder / "final" / "adapter_bundle.pt",
34
+ ]
35
+ existing = [path for path in candidate_files if path.exists()]
36
+ missing = [str(path) for path in candidate_files if not path.exists()]
37
+ if not existing:
38
  raise FileNotFoundError(f"Missing expected adapter files: {', '.join(missing)}")
39
 
40
  api = HfApi(token=token)