Upload unsloth_train.py with huggingface_hub
Browse files- unsloth_train.py +19 -7
unsloth_train.py
CHANGED
|
@@ -78,13 +78,25 @@ def main():
|
|
| 78 |
model.print_trainable_parameters()
|
| 79 |
|
| 80 |
print("[2/4] loading dataset", flush=True)
|
| 81 |
-
if
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
ds = load_dataset("json", data_files=shards, split="train")
|
| 89 |
if args.limit:
|
| 90 |
ds = ds.select(range(args.limit))
|
|
|
|
| 78 |
model.print_trainable_parameters()
|
| 79 |
|
| 80 |
print("[2/4] loading dataset", flush=True)
|
| 81 |
+
# robust: if the given path is missing, search common locations
|
| 82 |
+
candidates = [args.data]
|
| 83 |
+
if not os.path.exists(args.data):
|
| 84 |
+
candidates += ["/root/baap-ds/data", "/root/baap-data",
|
| 85 |
+
"/root/baap-ds", "/root/data", "/root"]
|
| 86 |
+
shards = []
|
| 87 |
+
for c in candidates:
|
| 88 |
+
if os.path.isdir(c):
|
| 89 |
+
found = sorted(glob.glob(os.path.join(c, "**", "*.jsonl.gz"),
|
| 90 |
+
recursive=True))
|
| 91 |
+
if found:
|
| 92 |
+
shards = found
|
| 93 |
+
print("[2/4] found %d shards in %s" % (len(shards), c), flush=True)
|
| 94 |
+
break
|
| 95 |
+
elif os.path.isfile(c):
|
| 96 |
+
shards = [c]
|
| 97 |
+
break
|
| 98 |
+
if not shards:
|
| 99 |
+
sys.exit("no *.jsonl.gz found (tried: %s)" % ", ".join(candidates))
|
| 100 |
ds = load_dataset("json", data_files=shards, split="train")
|
| 101 |
if args.limit:
|
| 102 |
ds = ds.select(range(args.limit))
|