Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

config.yml 18 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
  1. version: 2.1
  2. parameters:
  3. remote_docker_version:
  4. type: string
  5. description: remote docker version
  6. default: "20.10.18"
  7. orb_version:
  8. type: string
  9. description: Deci ai ORB version https://circleci.com/developer/orbs/orb/deci-ai/circleci-common-orb
  10. default: "10.3.1"
  11. # default: "dev:alpha"
  12. orbs:
  13. deci-common: deci-ai/circleci-common-orb@<< pipeline.parameters.orb_version >>
  14. aws-ecr: circleci/aws-ecr@8.2.1
  15. docker: circleci/docker@2.2.0
  16. slack: circleci/slack@4.12.0 # see https://circleci.com/developer/orbs/orb/circleci/slack for examples and more
  17. # This filter operates on SemVer2 tags only
  18. release_tag_filter: &release_tag_filter
  19. filters:
  20. branches:
  21. ignore: /.*/
  22. tags:
  23. only: /^\d+\.\d+\.\d+$/
  24. release_candidate_filter: &release_candidate_filter
  25. filters:
  26. branches:
  27. only: master
  28. release_candidate_tag_filter: &release_candidate_tag_filter
  29. filters:
  30. branches:
  31. ignore: /.*/
  32. tags:
  33. only: /^\d+\.\d+\.\d+rc\d+/
  34. commands:
  35. get_beta_and_rc_tags:
  36. description: "getting beta and rc tag (if exist) according to ouir convention"
  37. steps:
  38. - attach_workspace:
  39. at: ~/
  40. - run:
  41. name: push BETA_TAG and RC_TAG variable to BASH_ENV
  42. command: |
  43. if [[ -f ~/BETA_TAG ]]; then
  44. echo 'export BETA_TAG="$(cat ~/BETA_TAG)"' >> "$BASH_ENV"
  45. fi
  46. if [[ -f ~/RC_TAG ]]; then
  47. echo 'export RC_TAG="$(cat ~/RC_TAG)"' >> "$BASH_ENV"
  48. fi
  49. source $BASH_ENV
  50. echo "RC_TAG=$RC_TAG || BETA_TAG=$BETA_TAG"
  51. adding_tag_to_ecr_container_image:
  52. description: adding a tag to an existing container image
  53. parameters:
  54. image_repo:
  55. type: string
  56. new_image_tag:
  57. type: string
  58. source_image_tag:
  59. type: string
  60. steps:
  61. - deci-common/run_on_dev_account:
  62. command: |
  63. MANIFEST=$(aws ecr batch-get-image --repository-name << parameters.image_repo >> --image-ids imageTag=<< parameters.source_image_tag >> --query 'images[].imageManifest' --output text)
  64. aws ecr put-image --repository-name << parameters.image_repo >> --image-tag << parameters.new_image_tag >> --image-manifest "$MANIFEST"
  65. echo "added tag: << parameters.new_image_tag >> to image: << parameters.image_repo >>:<< parameters.new_image_tag >>"
  66. jobs:
  67. build:
  68. parameters:
  69. py_version:
  70. type: string
  71. default: latest
  72. package_name:
  73. type: string
  74. docker:
  75. - image: cimg/python:<< parameters.py_version >>
  76. resource_class: large
  77. steps:
  78. - deci-common/checkout_and_skip_build:
  79. check_version_file: true
  80. - deci-common/get_persisted_version_info
  81. - when:
  82. condition:
  83. and:
  84. - not:
  85. equal: [ develop, << pipeline.git.branch >> ]
  86. - not:
  87. equal: [ staging, << pipeline.git.branch >> ]
  88. - not:
  89. equal: [ master, << pipeline.git.branch >> ]
  90. steps:
  91. - run:
  92. name: install Black Flake8 python linter
  93. command: |
  94. pip install --user -r requirements.dev.txt
  95. - run:
  96. name: Lint all python files changed since develop branch
  97. command: |
  98. flake8 --statistics --config scripts/flake8-config setup.py $(git diff --diff-filter ACM origin/master --name-only | grep 'py$' | grep -v 'experimental/' | grep -v 'experimental_models/')
  99. - run:
  100. name: Run Black on changed files against master branch
  101. command: |
  102. black --check setup.py $(git diff --diff-filter ACM origin/master --name-only | grep 'py$' | grep -v 'experimental/' | grep -v 'experimental_models/')
  103. - run:
  104. name: add requirements.txt and requirements.pro.txt to source code
  105. command: |
  106. cp requirements.txt src/super_gradients/requirements.txt
  107. cp requirements.pro.txt src/super_gradients/requirements.pro.txt
  108. - run:
  109. name: install python dependencies
  110. command: |
  111. python3 -m venv venv
  112. . venv/bin/activate
  113. python3 -m pip install pip==22.0.4
  114. cat requirements.txt | cut -f1 -d"#" | xargs -n 1 -L 1 pip install --progress-bar off
  115. - run:
  116. name: edit package version
  117. command: |
  118. echo "${NEW_VERSION}" > version.txt
  119. cat version.txt
  120. - run:
  121. name: setup custom environment variables
  122. command: |
  123. echo 'export PYTHONPATH=/home/circleci/super_gradients' >> $BASH_ENV
  124. echo 'export UPLOAD_LOGS=FALSE' >> $BASH_ENV
  125. - run:
  126. name: install package
  127. no_output_timeout: 30m
  128. command: |
  129. . venv/bin/activate
  130. python3 -m pip install --extra-index-url https://pypi.ngc.nvidia.com .[pro]
  131. - run:
  132. name: run tests with coverage
  133. no_output_timeout: 30m
  134. command: |
  135. . venv/bin/activate
  136. coverage run --source=super_gradients -m unittest tests/deci_core_unit_test_suite_runner.py
  137. coverage report
  138. coverage html # open htmlcov/index.html in a browser
  139. - store_artifacts:
  140. path: htmlcov
  141. - store_artifacts:
  142. path: ~/sg_logs
  143. change_rc_to_b:
  144. description: "change rc in the tag to b"
  145. docker:
  146. - image: cimg/base:stable-20.04
  147. resource_class: small
  148. steps:
  149. - run:
  150. name: change the rc to b
  151. command:
  152. |
  153. BETA_TAG=$(echo ${CIRCLE_TAG} | sed -e 's|rc|b|'); echo ${BETA_TAG} >> ~/BETA_TAG
  154. cat ~/BETA_TAG
  155. - persist_to_workspace:
  156. root: ~/
  157. paths:
  158. - "BETA_TAG"
  159. build_and_publish_sg_container:
  160. description : "building the temp image and pushing to dev ecr"
  161. parameters:
  162. repo_name:
  163. type: string
  164. default: 'deci/super-gradients'
  165. sg_python_version:
  166. type: string
  167. default: $CIRCLE_TAG
  168. docker:
  169. - image: cimg/base:stable-20.04
  170. resource_class: small
  171. steps:
  172. - checkout
  173. - get_beta_and_rc_tags
  174. - run:
  175. command: echo *$BETA_TAG*
  176. - setup_remote_docker:
  177. version: << pipeline.parameters.remote_docker_version >>
  178. docker_layer_caching: true
  179. - deci-common/container_image_build:
  180. dockerfile: scripts/Dockerfile
  181. repository_name: << parameters.repo_name >>
  182. image_tag: "$BETA_TAG"
  183. build_args: 'SG_VERSION=<< parameters.sg_python_version >>'
  184. extra_flags: ' --compress'
  185. - deci-common/push_docker_image_aws_dev:
  186. repository_name: << parameters.repo_name >>
  187. image_tag: "$BETA_TAG"
  188. additional_tags: "latest"
  189. find_rc_tag_per_sha:
  190. description: this command will take the sha of the last commit and find the rc tag it belongs to as ${RC_TAG} variale
  191. docker:
  192. - image: cimg/aws:2022.11.1
  193. resource_class: small
  194. steps:
  195. - checkout
  196. - run:
  197. name: get rc tag of the final tag
  198. command: |
  199. RC_TAG=$(git tag --contains ${CIRCLE_SHA1} | grep -E '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+rc[[:digit:]]+' | head -n 1)
  200. echo "Found RC version: ${RC_TAG}"
  201. echo $RC_TAG >> ~/RC_TAG
  202. - persist_to_workspace:
  203. root: ~/
  204. paths:
  205. - "RC_TAG"
  206. add_rc_tag_to_beta:
  207. description: in the event of successful test promote beta to rc
  208. parameters:
  209. image_repo:
  210. type: string
  211. default: "deci/super-gradients"
  212. docker:
  213. - image: cimg/base:stable-20.04
  214. resource_class: small
  215. steps:
  216. - get_beta_and_rc_tags
  217. - run:
  218. command: |
  219. echo $BETA_TAG
  220. - adding_tag_to_ecr_container_image:
  221. image_repo: << parameters.image_repo >>
  222. source_image_tag: $BETA_TAG
  223. new_image_tag: $CIRCLE_TAG
  224. add_release_tag_to_rc:
  225. description: in the event of successful test promote rc to release and latest
  226. parameters:
  227. image_repo:
  228. type: string
  229. default: "deci/super-gradients"
  230. docker:
  231. - image: cimg/base:stable-20.04
  232. resource_class: small
  233. steps:
  234. - get_beta_and_rc_tags
  235. - run:
  236. command: |
  237. echo $RC_TAG
  238. - adding_tag_to_ecr_container_image:
  239. image_repo: << parameters.image_repo >>
  240. source_image_tag: $RC_TAG
  241. new_image_tag: ${CIRCLE_TAG}
  242. testing_supergradients_docker_image:
  243. description: "running integration test on the code"
  244. parameters:
  245. image_repo:
  246. type: string
  247. #reserved for testing when will be done
  248. #machine: true
  249. #resource_class: deci-ai/research-standard
  250. docker:
  251. - image: cimg/base:stable-20.04
  252. steps:
  253. - deci-common/ecr_login_dev
  254. - get_beta_and_rc_tags
  255. # - run:
  256. # name: integration test
  257. # #command: sudo docker run -it -e ENVIRONMENT_NAME=production -v ${PWD}:/SG -v /data:/data deciai/super-gradients:3.0.0 python3 ./tests/integration_tests/pretrained_models_test.py
  258. # command: docker run --rm -it --shm-size=2gb --gpus all -v ${PWD}:/SG -v /data:/data << parameters.image_repo >>:<< parameters.image_tag >> python3 -c 'print("it works!")'
  259. - run:
  260. command: echo Hello world
  261. release_candidate:
  262. parameters:
  263. py_version:
  264. type: string
  265. docker:
  266. - image: cimg/python:<< parameters.py_version >>
  267. steps:
  268. - deci-common/checkout_and_skip_build:
  269. check_version_file: true
  270. - deci-common/get_persisted_version_info
  271. - run:
  272. name: edit package version
  273. command: |
  274. echo $NEW_VERSION > version.txt
  275. - deci-common/pip_upload_package_codeartifact_dev:
  276. codeartifact_repository: "deci-packages"
  277. - deci-common/pip_test_package_installation_codeartifact_dev:
  278. package_name: "super-gradients"
  279. version: $NEW_VERSION
  280. - deci-common/git_config_automation_user
  281. - run:
  282. name: "commit version file"
  283. command: |
  284. git commit version.txt -m "Deci Services - Changed version to $NEW_VERSION"
  285. - deci-common/git_commit_and_tag:
  286. version: $NEW_VERSION
  287. release_version:
  288. parameters:
  289. py_version:
  290. type: string
  291. docker:
  292. - image: cimg/python:<< parameters.py_version >>
  293. steps:
  294. - deci-common/checkout_and_skip_build:
  295. check_version_file: true
  296. - run:
  297. name: verify __version__
  298. command: python3 tests/verify_version.py $CIRCLE_TAG
  299. - run:
  300. name: add requirements.txt and requirements.pro.txt to source code
  301. command: |
  302. cp requirements.txt src/super_gradients/requirements.txt
  303. cp requirements.pro.txt src/super_gradients/requirements.pro.txt
  304. - run:
  305. name: edit package version
  306. command: |
  307. echo $CIRCLE_TAG > version.txt
  308. - deci-common/pip_upload_package_codeartifact_all_accounts:
  309. codeartifact_repository: "deci-packages"
  310. - deci-common/pip_test_package_installation_codeartifact_dev:
  311. package_name: "super-gradients"
  312. version: $CIRCLE_TAG
  313. - deci-common/pip_test_package_installation_codeartifact_prod:
  314. package_name: "super-gradients"
  315. version: $CIRCLE_TAG
  316. - deci-common/pip_upload_package_codeartifact_prod:
  317. codeartifact_repository: "deci-toolkit"
  318. - deci-common/git_commit_and_tag:
  319. version: $CIRCLE_TAG
  320. delete_remote_tag_before_tagging: true
  321. - deci-common/tag_as:
  322. tag_name: "stable"
  323. delete_remote: true
  324. - deci-common/github_create_release:
  325. github_cli_token: $GITHUB_CLI_TOKEN
  326. directory_to_cd_into: "."
  327. tag: $CIRCLE_TAG
  328. notes: "This GitHub Release was done automatically by CircleCI"
  329. recipe_tests:
  330. machine: true
  331. resource_class: deci-ai/sg-gpu-on-premise
  332. parameters:
  333. sg_existing_env_path:
  334. type: string
  335. default: "/env/persistent_env"
  336. sg_new_env_name:
  337. type: string
  338. default: "${CIRCLE_BUILD_NUM}"
  339. sg_new_env_python_version:
  340. type: string
  341. default: "python3.8"
  342. steps:
  343. - checkout
  344. - run:
  345. name: install requirements and run recipe tests
  346. command: |
  347. << parameters.sg_new_env_python_version >> -m venv << parameters.sg_new_env_name >>
  348. source << parameters.sg_new_env_name >>/bin/activate
  349. python3.8 -m pip install --upgrade setuptools pip wheel
  350. python3.8 -m pip install -r requirements.txt
  351. python3.8 -m pip install .
  352. python3.8 -m pip install torch==1.12.0+cu116 torchvision==0.13.0+cu116 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu116
  353. python3.8 src/super_gradients/examples/train_from_recipe_example/train_from_recipe.py --config-name=cifar10_resnet experiment_name=shortened_cifar10_resnet_accuracy_test training_hyperparams.max_epochs=100 training_hyperparams.average_best_models=False multi_gpu=DDP num_gpus=4
  354. python3.8 src/super_gradients/examples/convert_recipe_example/convert_recipe_example.py --config-name=cifar10_conversion_params experiment_name=shortened_cifar10_resnet_accuracy_test
  355. python3.8 src/super_gradients/examples/train_from_recipe_example/train_from_recipe.py --config-name=coco2017_yolox experiment_name=shortened_coco2017_yolox_n_map_test architecture=yolox_n training_hyperparams.loss=yolox_fast_loss training_hyperparams.max_epochs=10 training_hyperparams.average_best_models=False multi_gpu=DDP num_gpus=4
  356. python3.8 src/super_gradients/examples/train_from_recipe_example/train_from_recipe.py --config-name=cityscapes_regseg48 experiment_name=shortened_cityscapes_regseg48_iou_test training_hyperparams.max_epochs=10 training_hyperparams.average_best_models=False multi_gpu=DDP num_gpus=4
  357. coverage run --source=super_gradients -m unittest tests/deci_core_recipe_test_suite_runner.py
  358. - run:
  359. name: Remove new environment when failed
  360. command: "rm -r << parameters.sg_new_env_name >>"
  361. when: on_fail
  362. workflows:
  363. release:
  364. jobs:
  365. - deci-common/persist_version_info:
  366. version_override: $CIRCLE_TAG
  367. <<: *release_tag_filter
  368. - deci-common/codeartifact_login:
  369. name: "login_to_codeartifact_release"
  370. repo_name: "deci-packages"
  371. <<: *release_tag_filter
  372. - build:
  373. name: "build3.7"
  374. py_version: "3.7"
  375. package_name: "super-gradients"
  376. requires:
  377. - deci-common/persist_version_info
  378. - login_to_codeartifact_release
  379. <<: *release_tag_filter
  380. - recipe_tests:
  381. <<: *release_tag_filter
  382. - release_version:
  383. py_version: "3.7"
  384. requires:
  385. - "build3.7"
  386. - recipe_tests
  387. <<: *release_tag_filter
  388. - deci-common/pip_upload_package_from_codeartifact_to_global_pypi:
  389. package_name: "super-gradients"
  390. name: "upload_super_gradients_to_pypi"
  391. version: $CIRCLE_TAG
  392. requires:
  393. - "release_version"
  394. context:
  395. - pypi-public
  396. <<: *release_tag_filter
  397. build_and_deploy:
  398. jobs:
  399. - recipe_tests
  400. SG_docker:
  401. jobs:
  402. - change_rc_to_b: # works on release candidate creation
  403. <<: *release_candidate_tag_filter
  404. - build_and_publish_sg_container: # works on release candidate creation
  405. requires:
  406. - "change_rc_to_b"
  407. <<: *release_candidate_tag_filter
  408. - testing_supergradients_docker_image: # works on release candidate creation
  409. image_repo: '307629990626.dkr.ecr.us-east-1.amazonaws.com/deci/super-gradients'
  410. requires:
  411. - "build_and_publish_sg_container"
  412. - "change_rc_to_b"
  413. <<: *release_candidate_tag_filter
  414. - add_rc_tag_to_beta: # works on release candidate creation for ECR Repo
  415. requires:
  416. - "testing_supergradients_docker_image"
  417. - "change_rc_to_b"
  418. <<: *release_candidate_tag_filter
  419. - find_rc_tag_per_sha: # works on release
  420. <<: *release_tag_filter
  421. - add_release_tag_to_rc: # works on release
  422. requires:
  423. - "find_rc_tag_per_sha"
  424. <<: *release_tag_filter
  425. - slack/on-hold:
  426. context: slack
  427. channel: "sg-integration-tests"
  428. requires:
  429. - "add_release_tag_to_rc"
  430. <<: *release_tag_filter
  431. - hold-sg-public-release: # works on release
  432. type: approval
  433. requires:
  434. - "slack/on-hold"
  435. <<: *release_tag_filter
  436. - docker/publish: # works on release
  437. image: deciai/super-gradients
  438. remote-docker-version: << pipeline.parameters.remote_docker_version >>
  439. update-description: true
  440. use-buildkit: true
  441. use-remote-docker: true
  442. use-docker-credentials-store: true
  443. tag: latest,${CIRCLE_TAG}
  444. extra_build_args: '--build-arg VERSION=${CIRCLE_TAG} --compress' #building from scratch as it faster and cheaper than download and retag
  445. requires:
  446. - "hold-sg-public-release"
  447. <<: *release_tag_filter
  448. - docker/publish: # works on release
  449. image: deciai/super-gradients
  450. remote-docker-version: << pipeline.parameters.remote_docker_version >>
  451. update-description: true
  452. use-buildkit: true
  453. use-remote-docker: true
  454. use-docker-credentials-store: true
  455. tag: ${CIRCLE_TAG}-runtime
  456. extra_build_args: '--build-arg VERSION=${CIRCLE_TAG} --build-arg DOCKER_IMAGE_TAG=11.3.1-runtime-ubuntu20.04 --compress'
  457. requires:
  458. - "hold-sg-public-release"
  459. <<: *release_tag_filter
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...