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

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

Comments

Loading...