Sync from GitHub via hub-sync
Browse files- train-classifier.py +8 -1
train-classifier.py
CHANGED
|
@@ -10,6 +10,11 @@
|
|
| 10 |
# "numpy",
|
| 11 |
# "huggingface-hub",
|
| 12 |
# ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# ///
|
| 14 |
"""
|
| 15 |
Fine-tune a text-classification encoder on a Hub dataset and push the trained model to the Hub.
|
|
@@ -727,7 +732,7 @@ def main(
|
|
| 727 |
per_device_train_batch_size=batch_size,
|
| 728 |
per_device_eval_batch_size=batch_size * 2,
|
| 729 |
gradient_accumulation_steps=grad_accum,
|
| 730 |
-
|
| 731 |
weight_decay=0.01,
|
| 732 |
bf16=bf16,
|
| 733 |
eval_strategy="epoch",
|
|
@@ -857,6 +862,8 @@ if __name__ == "__main__":
|
|
| 857 |
parser.add_argument("--private", action="store_true", help="Make output model repo private")
|
| 858 |
parser.add_argument("--hf-token", help="HF token (or set HF_TOKEN)")
|
| 859 |
args = parser.parse_args()
|
|
|
|
|
|
|
| 860 |
|
| 861 |
main(
|
| 862 |
input_dataset=args.input_dataset,
|
|
|
|
| 10 |
# "numpy",
|
| 11 |
# "huggingface-hub",
|
| 12 |
# ]
|
| 13 |
+
#
|
| 14 |
+
# [tool.hf-jobs]
|
| 15 |
+
# flavor = "l4x1"
|
| 16 |
+
# secrets = ["HF_TOKEN"]
|
| 17 |
+
# timeout = "1h"
|
| 18 |
# ///
|
| 19 |
"""
|
| 20 |
Fine-tune a text-classification encoder on a Hub dataset and push the trained model to the Hub.
|
|
|
|
| 732 |
per_device_train_batch_size=batch_size,
|
| 733 |
per_device_eval_batch_size=batch_size * 2,
|
| 734 |
gradient_accumulation_steps=grad_accum,
|
| 735 |
+
warmup_steps=warmup_ratio, # a float in [0, 1) is a ratio of total steps
|
| 736 |
weight_decay=0.01,
|
| 737 |
bf16=bf16,
|
| 738 |
eval_strategy="epoch",
|
|
|
|
| 862 |
parser.add_argument("--private", action="store_true", help="Make output model repo private")
|
| 863 |
parser.add_argument("--hf-token", help="HF token (or set HF_TOKEN)")
|
| 864 |
args = parser.parse_args()
|
| 865 |
+
if not 0 <= args.warmup_ratio < 1:
|
| 866 |
+
parser.error("--warmup-ratio must be in [0, 1)")
|
| 867 |
|
| 868 |
main(
|
| 869 |
input_dataset=args.input_dataset,
|