BHARGAV REDDY commited on
Upload push_code_to_hf.py with huggingface_hub
Browse files- push_code_to_hf.py +40 -2
push_code_to_hf.py
CHANGED
|
@@ -11,6 +11,7 @@ Usage:
|
|
| 11 |
|
| 12 |
import argparse
|
| 13 |
import os
|
|
|
|
| 14 |
from huggingface_hub import HfApi, create_repo
|
| 15 |
|
| 16 |
DEFAULT_CODE_REPO = "ASTERIZER/LUNA"
|
|
@@ -20,6 +21,7 @@ TOKEN = os.environ.get("HF_TOKEN")
|
|
| 20 |
FILES_TO_PUSH = [
|
| 21 |
# Core training scripts
|
| 22 |
"train.py",
|
|
|
|
| 23 |
"sft_train.py",
|
| 24 |
"lora_sft_train.py",
|
| 25 |
"chat.py",
|
|
@@ -28,6 +30,7 @@ FILES_TO_PUSH = [
|
|
| 28 |
|
| 29 |
# Configs
|
| 30 |
"train_config.yaml",
|
|
|
|
| 31 |
"train_continue_english_1b.yaml",
|
| 32 |
"sft_config.yaml",
|
| 33 |
"rag_mcp_lora_config.yaml",
|
|
@@ -59,6 +62,7 @@ FILES_TO_PUSH = [
|
|
| 59 |
# Instance run scripts
|
| 60 |
"run_english_1b_instance.sh",
|
| 61 |
"setup_and_train.sh",
|
|
|
|
| 62 |
"setup_and_sft.sh",
|
| 63 |
"gpu_train.sh",
|
| 64 |
"gpu_full_sft.sh",
|
|
@@ -83,6 +87,37 @@ FILES_TO_PUSH = [
|
|
| 83 |
"Base/checkpoints/EleutherAI/pythia-160m/tokenizer.json",
|
| 84 |
]
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
def main():
|
| 88 |
parser = argparse.ArgumentParser(description="Push LUNA code to HuggingFace")
|
|
@@ -107,8 +142,11 @@ def main():
|
|
| 107 |
)
|
| 108 |
print(f"Repo ready: https://huggingface.co/{'spaces/' if args.type == 'space' else ''}{args.repo}")
|
| 109 |
|
|
|
|
|
|
|
|
|
|
| 110 |
pushed = 0
|
| 111 |
-
for fpath in
|
| 112 |
if not os.path.exists(fpath):
|
| 113 |
print(f" SKIP (not found): {fpath}")
|
| 114 |
continue
|
|
@@ -122,7 +160,7 @@ def main():
|
|
| 122 |
print(f" OK: {fpath}")
|
| 123 |
pushed += 1
|
| 124 |
|
| 125 |
-
print(f"\nPushed {pushed}/{len(
|
| 126 |
|
| 127 |
|
| 128 |
if __name__ == "__main__":
|
|
|
|
| 11 |
|
| 12 |
import argparse
|
| 13 |
import os
|
| 14 |
+
from pathlib import Path
|
| 15 |
from huggingface_hub import HfApi, create_repo
|
| 16 |
|
| 17 |
DEFAULT_CODE_REPO = "ASTERIZER/LUNA"
|
|
|
|
| 21 |
FILES_TO_PUSH = [
|
| 22 |
# Core training scripts
|
| 23 |
"train.py",
|
| 24 |
+
"train_300m.py",
|
| 25 |
"sft_train.py",
|
| 26 |
"lora_sft_train.py",
|
| 27 |
"chat.py",
|
|
|
|
| 30 |
|
| 31 |
# Configs
|
| 32 |
"train_config.yaml",
|
| 33 |
+
"train_config_300m.yaml",
|
| 34 |
"train_continue_english_1b.yaml",
|
| 35 |
"sft_config.yaml",
|
| 36 |
"rag_mcp_lora_config.yaml",
|
|
|
|
| 62 |
# Instance run scripts
|
| 63 |
"run_english_1b_instance.sh",
|
| 64 |
"setup_and_train.sh",
|
| 65 |
+
"setup_and_train_300m.sh",
|
| 66 |
"setup_and_sft.sh",
|
| 67 |
"gpu_train.sh",
|
| 68 |
"gpu_full_sft.sh",
|
|
|
|
| 87 |
"Base/checkpoints/EleutherAI/pythia-160m/tokenizer.json",
|
| 88 |
]
|
| 89 |
|
| 90 |
+
EVALUATION_GLOBS = [
|
| 91 |
+
"Evaluation/*.py",
|
| 92 |
+
"Evaluation/*.sh",
|
| 93 |
+
"Evaluation/*.yaml",
|
| 94 |
+
"Evaluation/*.yml",
|
| 95 |
+
"Evaluation/*.md",
|
| 96 |
+
"Evaluation/*.txt",
|
| 97 |
+
"Evaluation/*.json",
|
| 98 |
+
]
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def build_file_list():
|
| 102 |
+
files = []
|
| 103 |
+
seen = set()
|
| 104 |
+
|
| 105 |
+
for fpath in FILES_TO_PUSH:
|
| 106 |
+
if fpath not in seen:
|
| 107 |
+
files.append(fpath)
|
| 108 |
+
seen.add(fpath)
|
| 109 |
+
|
| 110 |
+
for pattern in EVALUATION_GLOBS:
|
| 111 |
+
for path in sorted(Path(".").glob(pattern)):
|
| 112 |
+
if not path.is_file():
|
| 113 |
+
continue
|
| 114 |
+
rel = path.as_posix()
|
| 115 |
+
if rel not in seen:
|
| 116 |
+
files.append(rel)
|
| 117 |
+
seen.add(rel)
|
| 118 |
+
|
| 119 |
+
return files
|
| 120 |
+
|
| 121 |
|
| 122 |
def main():
|
| 123 |
parser = argparse.ArgumentParser(description="Push LUNA code to HuggingFace")
|
|
|
|
| 142 |
)
|
| 143 |
print(f"Repo ready: https://huggingface.co/{'spaces/' if args.type == 'space' else ''}{args.repo}")
|
| 144 |
|
| 145 |
+
files_to_push = build_file_list()
|
| 146 |
+
print(f"Preparing to push {len(files_to_push)} files...")
|
| 147 |
+
|
| 148 |
pushed = 0
|
| 149 |
+
for fpath in files_to_push:
|
| 150 |
if not os.path.exists(fpath):
|
| 151 |
print(f" SKIP (not found): {fpath}")
|
| 152 |
continue
|
|
|
|
| 160 |
print(f" OK: {fpath}")
|
| 161 |
pushed += 1
|
| 162 |
|
| 163 |
+
print(f"\nPushed {pushed}/{len(files_to_push)} files to https://huggingface.co/{'spaces/' if args.type == 'space' else ''}{args.repo}")
|
| 164 |
|
| 165 |
|
| 166 |
if __name__ == "__main__":
|