IvoHoese commited on
Commit
3451660
·
verified ·
1 Parent(s): 89b087c

Add files using upload-large-folder tool

Browse files
Files changed (49) hide show
  1. README.md +3 -0
  2. suspect_models/suspect_024.safetensors +3 -0
  3. suspect_models/suspect_030.safetensors +3 -0
  4. suspect_models/suspect_034.safetensors +3 -0
  5. suspect_models/suspect_053.safetensors +3 -0
  6. suspect_models/suspect_056.safetensors +3 -0
  7. suspect_models/suspect_057.safetensors +3 -0
  8. suspect_models/suspect_063.safetensors +3 -0
  9. suspect_models/suspect_067.safetensors +3 -0
  10. suspect_models/suspect_078.safetensors +3 -0
  11. suspect_models/suspect_086.safetensors +3 -0
  12. suspect_models/suspect_092.safetensors +3 -0
  13. suspect_models/suspect_098.safetensors +3 -0
  14. suspect_models/suspect_105.safetensors +3 -0
  15. suspect_models/suspect_132.safetensors +3 -0
  16. suspect_models/suspect_170.safetensors +3 -0
  17. suspect_models/suspect_173.safetensors +3 -0
  18. suspect_models/suspect_181.safetensors +3 -0
  19. suspect_models/suspect_188.safetensors +3 -0
  20. suspect_models/suspect_194.safetensors +3 -0
  21. suspect_models/suspect_197.safetensors +3 -0
  22. suspect_models/suspect_198.safetensors +3 -0
  23. suspect_models/suspect_203.safetensors +3 -0
  24. suspect_models/suspect_204.safetensors +3 -0
  25. suspect_models/suspect_212.safetensors +3 -0
  26. suspect_models/suspect_223.safetensors +3 -0
  27. suspect_models/suspect_227.safetensors +3 -0
  28. suspect_models/suspect_254.safetensors +3 -0
  29. suspect_models/suspect_255.safetensors +3 -0
  30. suspect_models/suspect_269.safetensors +3 -0
  31. suspect_models/suspect_275.safetensors +3 -0
  32. suspect_models/suspect_283.safetensors +3 -0
  33. suspect_models/suspect_286.safetensors +3 -0
  34. suspect_models/suspect_291.safetensors +3 -0
  35. suspect_models/suspect_294.safetensors +3 -0
  36. suspect_models/suspect_297.safetensors +3 -0
  37. suspect_models/suspect_304.safetensors +3 -0
  38. suspect_models/suspect_309.safetensors +3 -0
  39. suspect_models/suspect_311.safetensors +3 -0
  40. suspect_models/suspect_314.safetensors +3 -0
  41. suspect_models/suspect_324.safetensors +3 -0
  42. suspect_models/suspect_332.safetensors +3 -0
  43. suspect_models/suspect_342.safetensors +3 -0
  44. suspect_models/suspect_344.safetensors +3 -0
  45. suspect_models/suspect_350.safetensors +3 -0
  46. suspect_models/suspect_351.safetensors +3 -0
  47. target_model/train_main_idx.json +0 -0
  48. target_model/weights.safetensors +3 -0
  49. task_template.py +186 -0
README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
suspect_models/suspect_024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:13a837d2f2950bca92939fdbfcfa279b8e2ce3be060a2d92e74f7f48c1b5bdf3
3
+ size 44929864
suspect_models/suspect_030.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4df7cffefed6f5e509ebd045e540f54f2accd5415e49a68df048985f40b8c330
3
+ size 44929864
suspect_models/suspect_034.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4359eb8a97f5071bba90e9909293956f28f4f15b3316a3c90f6722c2e3d69b60
3
+ size 44929864
suspect_models/suspect_053.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7f1d37dfe311eea905035a0b2e0a5e7985ef644bef7b14fa29024d571efb6eb
3
+ size 44929864
suspect_models/suspect_056.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2644eec4aec6081ef03c47bb65c21671946735d8cbcbe0d872d2ceed1dd8920
3
+ size 44929864
suspect_models/suspect_057.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2949dd0da9fb4bd8b9338a16fa0cdc9b4e63700ee0a32db451f62dcab3e4b3af
3
+ size 44929864
suspect_models/suspect_063.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a861dea77c4eca92c3c5ca4c71b6f0e57dc4212aedd8704a73cf593ac89a127a
3
+ size 44929864
suspect_models/suspect_067.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b23ba71435cdd05202357f922095c13c5d587d2a9ba35d65577d55d294425a5
3
+ size 44929864
suspect_models/suspect_078.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb82cb73f0a243938011508c2af154add290de7146d937e00608db88297f4c50
3
+ size 44929864
suspect_models/suspect_086.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1110e17f35d8360a4c55e5a4fa5100b9996577a9abc7f39b42040d9e7731476d
3
+ size 44929864
suspect_models/suspect_092.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38a7ca5d27ab192fff5ede62770fbe41459f4c753daa671c4797126bef6a6da8
3
+ size 44929864
suspect_models/suspect_098.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f28e8edbcbc4d5a7f496755a2acfa06c1a5c7e5d9a36afc2ec17c374c09e3974
3
+ size 44929864
suspect_models/suspect_105.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:802485c793646eb8251c5e0307332f9151791533a0241aa117085f4f6d1ee832
3
+ size 44929864
suspect_models/suspect_132.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:89bd5b9aa543fcde5a3cc82cbf96938cd4bd01d7dbbacbfc85a0d57b07610e00
3
+ size 44929864
suspect_models/suspect_170.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7444a7542dcbc3660cd92a8df6fc7026c36689cd6d377554b2f0576280c125c0
3
+ size 44929864
suspect_models/suspect_173.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e10c3451c740f2863bb029ee33a2374a321d3a16bbd65d5eb5fd6e110fe0a9b
3
+ size 44929864
suspect_models/suspect_181.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:89a819c79b9d38572382cdc2a96ae49654b152eb10d0b57d07f948492d3f5a6d
3
+ size 44929864
suspect_models/suspect_188.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5b4ed3b4e8c15901aceea8d4e63b626b53494d96a42dde36aaf02f1f80aeb02
3
+ size 44929864
suspect_models/suspect_194.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53f8c59ddd6db0d63392ad5c897f9305f934dcccdc4391111a970263992eb088
3
+ size 44929864
suspect_models/suspect_197.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81b2385f33b53a312d1ea4e1f9323df6d26ca84bc40fafbded314d9435e9d1ec
3
+ size 44929864
suspect_models/suspect_198.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f33cfd7949b943c5b0af8f4a17547ce2224d8e0540c08da8bc70acb0a55e70c0
3
+ size 44929864
suspect_models/suspect_203.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:286e0c23c67beb494c964aa44baef20589ed41f7d0a975f918ce730eb4ac302c
3
+ size 44929864
suspect_models/suspect_204.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aadc3804c303109bf82250d69095da476a5baa2cd92fba0d01563c9a85f45c11
3
+ size 44929864
suspect_models/suspect_212.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61f5d75aff59dd5b595493dcda71836b6dc4fedfdb480b55eb41b53f4cdeffcf
3
+ size 44929864
suspect_models/suspect_223.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd3791a722b14b634816cabfdcc174b98bae768098fe776f7edff50f953b3691
3
+ size 44929864
suspect_models/suspect_227.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:29f87234320c85bd851358e5c9e49b3bac8b4b594d3aeb9dcf01b53dde521c6f
3
+ size 44929864
suspect_models/suspect_254.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a09e47fb8432b1d8d4bda18d47d49025aaa6b46c97b8183e8798ec7def547f64
3
+ size 44929864
suspect_models/suspect_255.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23d4b871c31f9b291431524d84dc9d91dc5550cd3d95459d3b08b262998e4743
3
+ size 44929864
suspect_models/suspect_269.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5689dca6451a52f122af171c873d749167bb4d1b0d3c0e70a285dd9cae1e821b
3
+ size 44929864
suspect_models/suspect_275.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d20fb9ed88b59c66b117fabe7303736706ed81c0313c6d183dd8dc697db71402
3
+ size 44929864
suspect_models/suspect_283.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e0794b124ac905ab58c931f19de63d78ae0b4f244d5ffa51c73babd09a2c0102
3
+ size 44929864
suspect_models/suspect_286.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4fbcfac2a3ea7a48426dc7b11431c549fe37aa3380d94689e43782a57f6e7c1e
3
+ size 44929864
suspect_models/suspect_291.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1186f41c9da8e7c10a006e37b617e15d2e944cdc3c3217da2852e103acf50b13
3
+ size 44929864
suspect_models/suspect_294.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:08970a8edc60e2a33b824be3044c546914cda719a1aa63d5958260272f4b0a81
3
+ size 44929864
suspect_models/suspect_297.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d71fa4bc0c8dd58359b588b3aa63c429badfabdaa101f9796533e85ccc0ef796
3
+ size 44929864
suspect_models/suspect_304.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:31811d2730dcfb0393d1f9cdfda933a51e663745b1d6bb877b816202ae565620
3
+ size 44929864
suspect_models/suspect_309.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:914028888fd085ebfba8e80e878b4e67e8d24260fdaa2ae1367abc38441b220f
3
+ size 44929864
suspect_models/suspect_311.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ddd9b8773b0b30ec1c4c762822a4e091d7662a5d81627632d1c74886f62c3cc5
3
+ size 44929864
suspect_models/suspect_314.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:51da31b72c58bd10b8e07a97d67c4587a36150c32e0ef05bf78cb947a476a5e6
3
+ size 44929864
suspect_models/suspect_324.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:29b0b135524491bf8f16a2e63b760b7f8ee80921256f6d14f961094ab3769aa9
3
+ size 44929864
suspect_models/suspect_332.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8364e6d36b80ddd8422891b8907a4bb4e0b2d517ff3f7e915ff05abfd967963
3
+ size 44929864
suspect_models/suspect_342.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:457a4b73c39298d7e595833d35ae34b8d297b2befe9f10a6b9e024c73bb4bebb
3
+ size 44929864
suspect_models/suspect_344.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0be0eef0484a324579056135a5f57278fa395d6c65d610c47684533aa36b85eb
3
+ size 44929864
suspect_models/suspect_350.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:243433f0de26d4197d2d26449713ee950628a0d59cb72931861e27ee645b562c
3
+ size 44929864
suspect_models/suspect_351.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a74c61cd836cf2c91c110884d7ed967689944f4973bc4a236ca5fbb128a8042
3
+ size 44929864
target_model/train_main_idx.json ADDED
The diff for this file is too large to render. See raw diff
 
target_model/weights.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e4e7426a9531d53be2324892a0a9626f500c2407a1baf447b6b51780e0e22bad
3
+ size 44929864
task_template.py ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ import requests
4
+ from pathlib import Path
5
+ import torch
6
+ import torch.nn as nn
7
+ from torchvision import datasets, transforms
8
+ from torchvision.models import resnet18
9
+ from safetensors.torch import load_file
10
+ import pandas as pd
11
+
12
+ # --------------------------------
13
+ # LOADING A MODEL (EXAMPLE: TARGET MODEL)
14
+ # --------------------------------
15
+
16
+ def make_model():
17
+ model = resnet18(weights=None)
18
+ model.conv1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1, bias=False)
19
+ model.maxpool = nn.Identity()
20
+ model.fc = nn.Linear(model.fc.in_features, 100)
21
+ return model
22
+
23
+ checkpoint_path = "path/to/your/model_checkpoint.safetensors" # Replace with your model checkpoint path
24
+ state_dict = load_file(checkpoint_path, device="cpu")
25
+
26
+ model = make_model()
27
+ model.load_state_dict(state_dict, strict=True)
28
+ model.eval()
29
+
30
+ transform = transforms.Compose([
31
+ transforms.ToTensor(),
32
+ transforms.Normalize((0.5071, 0.4867, 0.4408),
33
+ (0.2675, 0.2565, 0.2761)),
34
+ ])
35
+
36
+ data_root = "path/to/cifar100" # Replace with your CIFAR-100 dataset path, or where it should be downloaded
37
+ dataset = datasets.CIFAR100(root=data_root, train=False, download=True, transform=transform)
38
+ x, y = dataset[0] # Example: get the first image and label
39
+
40
+ with torch.no_grad():
41
+ logits = model(x.unsqueeze(0))
42
+
43
+ print("True label:", y)
44
+ print("Logits shape:", logits.shape) # Should be [1, 100] for CIFAR-100
45
+ print("Logits:", logits)
46
+
47
+ # # --------------------------------
48
+ # # SUBMISSION FORMAT
49
+ # # --------------------------------
50
+
51
+ """
52
+ The submission must be a .csv file with the following format:
53
+
54
+ -"id": ID of the subset (from 0 to 359)
55
+ -"score": Stealing confidence score for each image (float)
56
+ """
57
+
58
+ # Example Submission:
59
+
60
+ subset_ids = list(range(360))
61
+ confidence_scores = torch.rand(len(subset_ids)).tolist()
62
+ submission_df = pd.DataFrame({
63
+ "id": subset_ids,
64
+ "score": confidence_scores
65
+ })
66
+ submission_df.to_csv("example_submission.csv", index=None)
67
+
68
+ # --------------------------------
69
+ # SUBMISSION PROCESS
70
+ # --------------------------------
71
+
72
+ """
73
+ Example submission script for the Stolen Model Detection Task.
74
+
75
+ Submission Requirements (read carefully to avoid automatic rejection):
76
+
77
+ 1. CSV FORMAT
78
+ ----------------
79
+ - The file **must be a CSV** with extension `.csv`.
80
+ - It must contain **exactly two columns**, named:
81
+ id, score
82
+ → Column names must match exactly (lowercase, no extra spaces).
83
+ → Column order does not matter, but both must be present.
84
+
85
+ 2. ROW COUNT AND IDENTIFIERS
86
+ -------------------------------
87
+ - Your file must contain **exactly 360 rows**.
88
+ - Each row corresponds to one unique `id` in the range **0–359** (inclusive).
89
+ - Every id must appear **exactly once**.
90
+ - Do **not** add, remove, or rename any IDs.
91
+ - Do **not** include duplicates or missing entries.
92
+ - The evaluator checks:
93
+ id.min() == 0
94
+ id.max() == 359
95
+ id.unique().size == 360
96
+
97
+ 3. STEALING CONFIDENCE SCORES
98
+ ----------------------
99
+ - The `score` column must contain **numeric values** representing your model’s predicted confidence
100
+ that the corresponding subset is a **stolen** model.
101
+
102
+ Examples of valid score values:
103
+ - Probabilities: values in [0.0, 1.0]
104
+ - Raw model scores: any finite numeric values (will be ranked for TPR@FPR=0.05)
105
+
106
+ - Do **not** submit string labels like "yes"/"no" or "stolen"/"not stolen".
107
+ - The evaluator converts your `score` column to numeric using `pd.to_numeric()`.
108
+ → Any non-numeric, NaN, or infinite entries will cause automatic rejection.
109
+
110
+ 4. TECHNICAL LIMITS
111
+ ----------------------
112
+ - Maximum file size: **20 MB**
113
+ - Encoding: UTF-8 recommended.
114
+ - Avoid extra columns, blank lines, or formulas.
115
+ - Ensure all values are numeric and finite.
116
+ - Supported data types: int, float (e.g., float32, float64)
117
+
118
+ 5. VALIDATION SUMMARY
119
+ ------------------------
120
+ Your submission will fail if:
121
+ - Columns don’t match exactly ("id", "score")
122
+ - Row count differs from 360
123
+ - Any id is missing, duplicated, or outside [0, 359]
124
+ - Any score value is NaN, Inf, or non-numeric
125
+ - File is too large or not a valid CSV
126
+
127
+ One key metric is computed:
128
+ 1. **TPR@FPR=0.05 (True Positive Rate at False Positive Rate = 0.05)**
129
+ — measures the ability to correctly identify stolen models while keeping the false positive rate at 5%.
130
+ """
131
+
132
+ BASE_URL = "http://35.192.205.84:80"
133
+ API_KEY = "YOUR_API_KEY_HERE" # replace with your actual API key
134
+
135
+ TASK_ID = "19-stolen-model-detection"
136
+ FILE_PATH = "PATH/TO/YOUR/SUBMISSION.csv" # replace with your actual file path
137
+
138
+ SUBMIT = False # Set to True to enable submission
139
+
140
+ def die(msg):
141
+ print(f"{msg}", file=sys.stderr)
142
+ sys.exit(1)
143
+
144
+ if SUBMIT:
145
+ if not os.path.isfile(FILE_PATH):
146
+ die(f"File not found: {FILE_PATH}")
147
+
148
+ try:
149
+ with open(FILE_PATH, "rb") as f:
150
+ files = {
151
+ # (fieldname) -> (filename, fileobj, content_type)
152
+ "file": (os.path.basename(FILE_PATH), f, "csv"),
153
+ }
154
+ resp = requests.post(
155
+ f"{BASE_URL}/submit/{TASK_ID}",
156
+ headers={"X-API-Key": API_KEY},
157
+ files=files,
158
+ timeout=(10, 120), # (connect timeout, read timeout)
159
+ )
160
+ # Helpful output even on non-2xx
161
+ try:
162
+ body = resp.json()
163
+ except Exception:
164
+ body = {"raw_text": resp.text}
165
+
166
+ if resp.status_code == 413:
167
+ die("Upload rejected: file too large (HTTP 413). Reduce size and try again.")
168
+
169
+ resp.raise_for_status()
170
+
171
+ submission_id = body.get("submission_id")
172
+ print("Successfully submitted.")
173
+ print("Server response:", body)
174
+ if submission_id:
175
+ print(f"Submission ID: {submission_id}")
176
+
177
+ except requests.exceptions.RequestException as e:
178
+ detail = getattr(e, "response", None)
179
+ print(f"Submission error: {e}")
180
+ if detail is not None:
181
+ try:
182
+ print("Server response:", detail.json())
183
+ except Exception:
184
+ print("Server response (text):", detail.text)
185
+ sys.exit(1)
186
+