davanstrien HF Staff commited on
Commit
597c897
·
verified ·
1 Parent(s): 613c130

Upload script.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. script.py +49 -0
script.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.10"
3
+ # dependencies = [
4
+ # "datasets",
5
+ # "tqdm",
6
+ # ]
7
+ # ///
8
+ """Template UV script for hfjobs.
9
+
10
+ This is a template script. Customize it for your needs!
11
+
12
+ Usage:
13
+ python script.py <input> <output> [--option value]
14
+ """
15
+
16
+ import argparse
17
+ from datasets import load_dataset
18
+ from tqdm import tqdm
19
+
20
+
21
+ def main():
22
+ parser = argparse.ArgumentParser(description="Template UV script")
23
+ parser.add_argument("input", help="Input dataset")
24
+ parser.add_argument("output", help="Output dataset")
25
+ parser.add_argument("--text-column", default="text", help="Text column name")
26
+
27
+ args = parser.parse_args()
28
+
29
+ print(f"Loading dataset: {args.input}")
30
+ dataset = load_dataset(args.input, split="train")
31
+
32
+ # Your processing logic here
33
+ print(f"Processing {len(dataset)} examples...")
34
+
35
+ # Example: simple transformation
36
+ def process_example(example):
37
+ # Add your transformation logic
38
+ return example
39
+
40
+ processed = dataset.map(process_example, desc="Processing")
41
+
42
+ print(f"Pushing to: {args.output}")
43
+ processed.push_to_hub(args.output)
44
+
45
+ print("✅ Done!")
46
+
47
+
48
+ if __name__ == "__main__":
49
+ main()