Abhishek Thakur
commited on
Commit
ยท
f227899
1
Parent(s):
7624780
use advanced mode
Browse files- competitions/submissions.py +16 -28
- competitions/utils.py +1 -0
competitions/submissions.py
CHANGED
@@ -219,25 +219,30 @@ class Submissions:
|
|
219 |
return user_info
|
220 |
|
221 |
def _create_autotrain_project(self, submission_id, competition_id, user_id, competition_type):
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
|
|
227 |
|
228 |
payload = {
|
229 |
"username": self.autotrain_username,
|
230 |
"proj_name": submission_id,
|
231 |
"task": 26,
|
232 |
"config": {
|
|
|
233 |
"language": "unk",
|
234 |
"max_models": 1,
|
235 |
-
"
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
|
|
|
|
|
|
241 |
},
|
242 |
}
|
243 |
|
@@ -249,23 +254,6 @@ class Submissions:
|
|
249 |
).json()
|
250 |
|
251 |
time.sleep(5)
|
252 |
-
# Upload data
|
253 |
-
payload = {
|
254 |
-
"split": 4,
|
255 |
-
"col_mapping": project_config["col_mapping"],
|
256 |
-
"load_config": {"max_size_bytes": 0, "shuffle": False},
|
257 |
-
"dataset_id": project_config["dataset_name"],
|
258 |
-
"dataset_config": project_config["dataset_config"],
|
259 |
-
"dataset_split": project_config["dataset_split"],
|
260 |
-
}
|
261 |
-
|
262 |
-
_ = http_post(
|
263 |
-
path=f"/projects/{project_json_resp['id']}/data/dataset",
|
264 |
-
payload=payload,
|
265 |
-
token=self.autotrain_token,
|
266 |
-
domain=self.autotrain_backend_api,
|
267 |
-
).json()
|
268 |
-
logger.info("๐พ๐พ๐พ Dataset creation done ๐พ๐พ๐พ")
|
269 |
|
270 |
# Process data
|
271 |
_ = http_post(
|
|
|
219 |
return user_info
|
220 |
|
221 |
def _create_autotrain_project(self, submission_id, competition_id, user_id, competition_type):
|
222 |
+
|
223 |
+
# task: Literal["competition"]
|
224 |
+
# competition_id = Field("", title="Competition ID")
|
225 |
+
# competition_type = Field("", title="Competition Type")
|
226 |
+
# user_id = Field("", title="Competition User ID")
|
227 |
+
# submission_id = Field("", title="Submission ID")
|
228 |
|
229 |
payload = {
|
230 |
"username": self.autotrain_username,
|
231 |
"proj_name": submission_id,
|
232 |
"task": 26,
|
233 |
"config": {
|
234 |
+
"advanced": True,
|
235 |
"language": "unk",
|
236 |
"max_models": 1,
|
237 |
+
"params": [
|
238 |
+
{
|
239 |
+
"task": "competition",
|
240 |
+
"competition_id": competition_id,
|
241 |
+
"competition_type": "generic",
|
242 |
+
"user_id": user_id,
|
243 |
+
"submission_id": submission_id,
|
244 |
+
}
|
245 |
+
],
|
246 |
},
|
247 |
}
|
248 |
|
|
|
254 |
).json()
|
255 |
|
256 |
time.sleep(5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
|
258 |
# Process data
|
259 |
_ = http_post(
|
competitions/utils.py
CHANGED
@@ -16,6 +16,7 @@ def http_post(path: str, token: str, payload=None, domain: str = None, params=No
|
|
16 |
)
|
17 |
except requests.exceptions.ConnectionError:
|
18 |
logger.error("โ Failed to reach AutoNLP API, check your internet connection")
|
|
|
19 |
response.raise_for_status()
|
20 |
return response
|
21 |
|
|
|
16 |
)
|
17 |
except requests.exceptions.ConnectionError:
|
18 |
logger.error("โ Failed to reach AutoNLP API, check your internet connection")
|
19 |
+
logger.info(response.text)
|
20 |
response.raise_for_status()
|
21 |
return response
|
22 |
|