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

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

Comments

Loading...