{"id":399023,"date":"2024-06-29T14:25:22","date_gmt":"2024-06-29T14:25:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=399023"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T14:25:22","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=399023","title":{"rendered":"<span>\u041d\u0430\u0434\u043e\u0435\u043b\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440? \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 Ray Lightning<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/a0a\/b8e\/f71\/a0ab8ef71537d167d2463859749ef6fd.jpg\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a0a\/b8e\/f71\/a0ab8ef71537d167d2463859749ef6fd.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>PyTorch Lightning \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0442\u044c Deep Learning \u043d\u0430 GPU, \u043d\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0432 \u0441\u0435\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 SLURM. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0440\u0435\u0448\u0430\u0435\u0442 \u043f\u0430\u043a\u0435\u0442 Ray Lightning, \u043e\u0431\u0437\u043e\u0440\u043e\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u043a \u0441\u0442\u0430\u0440\u0442\u0443 \u043f\u043e\u0442\u043e\u043a\u0430 <a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_130921&amp;utm_term=cat\">\u043a\u0443\u0440\u0441\u0430 \u043f\u043e Data Science<\/a>.<\/p>\n<hr\/>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u0438\u043c: \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0435 \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 GPU, \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0437\u0435\u043b:<\/p>\n<ul>\n<li>\n<p>\u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0438\u043c\u0435\u043b \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u0434\u0443;<\/p>\n<\/li>\n<li>\n<p>\u0438\u043c\u0435\u043b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 PyTorch;<\/p>\n<\/li>\n<li>\n<p>\u0442\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0437\u043b\u0435;<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u0432\u043e\u0442 \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438 PyTorch Lightning \u0432\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0451\u0442\u0435\u0441\u044c:<\/p>\n<ul>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u043e\u0431\u043b\u0430\u043a\u0435 (AWS, Azure, GCP \u0438\u043b\u0438 Kubernetes) \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0448\u0438\u0440\u043e\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u0435\u0442\u0435\u043d\u0446\u0438\u0439;<\/p>\n<\/li>\n<li>\n<p>\u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f Jupyter Notebook;<\/p>\n<\/li>\n<li>\n<p>\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u0437\u0430\u0442\u0440\u0430\u0442\u044b, \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0431\u0448\u0438\u0440\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/21f\/77a\/fc7\/21f77afc7325259e996f397ce0b67ead.png\" width=\"860\" height=\"368\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/21f\/77a\/fc7\/21f77afc7325259e996f397ce0b67ead.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043a\u043e\u0434\u0430?<\/p>\n<h2>\u0417\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 Ray Lightning<\/h2>\n<p><a href=\"https:\/\/github.com\/ray-project\/ray_lightning\">Ray Lightning<\/a> \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043b\u0430\u0433\u0438\u043d PyTorch Lightning \u0434\u043b\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0412\u043e\u0442 \u0435\u0433\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430:<\/p>\n<ul>\n<li>\n<p>\u0415\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c, \u043d\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043a\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p>\u041b\u0435\u0433\u043a\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c: \u043f\u0438\u0448\u0435\u043c \u043e\u0434\u0438\u043d \u043a\u043e\u0434 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e GPU \u0438 \u043c\u0435\u043d\u044f\u0435\u043c \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 Jupyter Notebook: \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 Ray Lightning, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c\u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438<a href=\"https:\/\/docs.ray.io\/en\/latest\/cluster\/cloud.html\"> Ray Cluster Launcher<\/a> \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043d\u0430 AWS\/Azure\/GCP.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043a\u0440\u0443\u043f\u043d\u043e\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u043d \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441<a href=\"https:\/\/docs.ray.io\/en\/latest\/tune\/index.html\"> Ray Tune<\/a> \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 SOTA. <\/p>\n<\/li>\n<li>\n<p>\u0410 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u043e\u043d \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439, \u0435\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0442\u043a\u0440\u044b\u0442!<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c Ray Lightning \u2014 <a href=\"https:\/\/ray.io\/\">Ray<\/a>, \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043d\u0430 Python.<\/p>\n<h2>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Ray Lightning?<\/h2>\n<p><a href=\"https:\/\/github.com\/ray-project\/ray_lightning\">Ray Lightning<\/a> \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 PyTorch Lightning, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c RayPlugin, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 Trainer. \u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0443 DDPSpawn, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043d\u043e\u0432\u044b\u0435 <a href=\"https:\/\/docs.ray.io\/en\/master\/actors.html\">\u0430\u043a\u0442\u043e\u0440\u044b Ray<\/a>. \u0410\u043a\u0442\u043e\u0440\u044b \u2014 \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b Python, \u043d\u043e \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Ray, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u0435 \u0432\u044b\u0445\u043e\u0434\u044f \u0438\u0437 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f Python.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a20\/ac2\/b99\/a20ac2b99f430115a611d2305103c3e1.png\" alt=\"\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0430\u043a\u0442\u043e\u0440\u043e\u0432 Ray \u0432 \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435\" title=\"\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0430\u043a\u0442\u043e\u0440\u043e\u0432 Ray \u0432 \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435\" width=\"806\" height=\"446\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a20\/ac2\/b99\/a20ac2b99f430115a611d2305103c3e1.png\"\/><figcaption>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0430\u043a\u0442\u043e\u0440\u043e\u0432 Ray \u0432 \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435<\/figcaption><\/figure>\n<p>\u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u043a\u0442\u043e\u0440\u0430 \u0435\u0441\u0442\u044c \u043a\u043e\u043f\u0438\u044f LightningModule, \u0430\u043a\u0442\u043e\u0440\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0433\u0440\u0443\u043f\u043f\u0443 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f PyTorch. Ray \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 DistributedDataParallel \u0441 \u0442\u043e\u0439 \u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u043d\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e, \u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043f\u043e \u043c\u0435\u0440\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e.<\/p>\n<h2>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u043c<\/h2>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430\u043c\u0438 \u0431\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0439 \u0441 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439, \u2014 \u044d\u0442\u043e \u043c\u0443\u0447\u0435\u043d\u0438\u0435. \u041d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0441 Ray, \u0433\u0434\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c <a href=\"https:\/\/docs.ray.io\/en\/master\/cluster\/cloud.html\">\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c<\/a>.<\/p>\n<p>\u042d\u0442\u043en \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 AWS, GCP, Azure, \u0438 \u0432 \u043d\u0451\u043c \u0435\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 Kubernetes, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 Ray \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0433\u0434\u0435 \u0443\u0433\u043e\u0434\u043d\u043e. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Ray \u043a\u043e\u0434 \u043b\u0435\u0433\u043a\u043e \u043c\u0438\u0433\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u043b\u0430\u043a\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0435. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Ray \u043d\u0430 AWS, \u043d\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b YAML:<\/p>\n<pre><code class=\"yaml\">cluster_name: ml  # Cloud-provider specific configuration. provider:     type: aws     region: us-west-2     availability_zone: us-west-2a,us-west-2b  # How Ray will authenticate with newly launched nodes. auth:     ssh_user: ubuntu  head_node:     InstanceType: p3.8xlarge     ImageId: latest_dlami      # You can provision additional disk space with a conf as follows     BlockDeviceMappings:         - DeviceName: \/dev\/sda1           Ebs:               VolumeSize: 100 worker_nodes:     InstanceType: p3.2xlarge     ImageId: latest_dlami  file_mounts: {     \"\/path1\/on\/remote\/machine\": \"\/path1\/on\/local\/machine\", }  # List of shell commands to run to set up nodes. setup_commands:     - pip install -U ray-lightning<\/code><\/pre>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0432 file_mounts \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0443\u0437\u043b\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0441\u044e\u0434\u0430. \u041b\u044e\u0431\u044b\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, pip install foobar) \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0432 setup_commands. \u041e\u043d\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. <\/p>\n<p>\u0417\u0430\u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0444\u0430\u0439\u043b YAML, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c ray up cluster.yaml, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c ray attach cluster.yaml, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u043e ssh \u043a \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u043c\u0443 \u0443\u0437\u043b\u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Ray. <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435, \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u0443\u0437\u043b\u044b, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0434\u0430\u043b\u044f\u044f \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435.<\/p>\n<h2>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0432\u0441\u0451<\/h2>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 MNIST \u0432 \u043e\u0431\u043b\u0430\u043a\u0435.<\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h2>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 Ray Lightning:<\/p>\n<pre><code class=\"bash\">pip install ray-lightning<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b PyTorch Lightning \u0438 Ray.<\/p>\n<h2>\u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a PyTorch Lightning<\/h2>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u043a\u043e\u0434 PyTorch Lightning. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u2014 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 LightningModule. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 MNIST \u0438\u0437 <a href=\"https:\/\/pytorch-lightning.readthedocs.io\/en\/latest\/starter\/introduction_guide.html\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 <\/a>\u043f\u043e PyTorch Lightning:<\/p>\n<pre><code class=\"python\">import pytorch_lightning as pl import torch from torch.utils.data import random_split, DataLoader from torchvision.datasets import MNIST from torchvision import transforms  class LightningMNISTClassifier(pl.LightningModule):     def __init__(self, config, data_dir=None):         super(LightningMNISTClassifier, self).__init__()          self.data_dir = data_dir         self.lr = config[\"lr\"]         layer_1, layer_2 = config[\"layer_1\"], config[\"layer_2\"]         self.batch_size = config[\"batch_size\"]          # mnist images are (1, 28, 28) (channels, width, height)         self.layer_1 = torch.nn.Linear(28 * 28, layer_1)         self.layer_2 = torch.nn.Linear(layer_1, layer_2)         self.layer_3 = torch.nn.Linear(layer_2, 10)         self.accuracy = pl.metrics.Accuracy()      def forward(self, x):         batch_size, channels, width, height = x.size()         x = x.view(batch_size, -1)         x = self.layer_1(x)         x = torch.relu(x)         x = self.layer_2(x)         x = torch.relu(x)         x = self.layer_3(x)         x = F.softmax(x, dim=1)         return x      def configure_optimizers(self):         return torch.optim.Adam(self.parameters(), lr=self.lr)      def training_step(self, train_batch, batch_idx):         x, y = train_batch         logits = self.forward(x)         loss = F.nll_loss(logits, y)         acc = self.accuracy(logits, y)         self.log(\"ptl\/train_loss\", loss)         self.log(\"ptl\/train_accuracy\", acc)         return loss      def validation_step(self, val_batch, batch_idx):         x, y = val_batch         logits = self.forward(x)         loss = F.nll_loss(logits, y)         acc = self.accuracy(logits, y)         return {\"val_loss\": loss, \"val_accuracy\": acc}      def validation_epoch_end(self, outputs):         avg_loss = torch.stack([x[\"val_loss\"] for x in outputs]).mean()         avg_acc = torch.stack([x[\"val_accuracy\"] for x in outputs]).mean()         self.log(\"ptl\/val_loss\", avg_loss)         self.log(\"ptl\/val_accuracy\", avg_acc)      def prepare_data(self):         self.dataset = MNIST(             self.data_dir,             train=True,             download=True,             transform=transforms.ToTensor())      def train_dataloader(self):         dataset = self.dataset         train_length = len(dataset)         dataset_train, _ = random_split(             dataset, [train_length - 5000, 5000],             generator=torch.Generator().manual_seed(0))         loader = DataLoader(             dataset_train,             batch_size=self.batch_size,             num_workers=1,             drop_last=True,             pin_memory=True,         )         return loader      def val_dataloader(self):         dataset = self.dataset         train_length = len(dataset)         _, dataset_val = random_split(             dataset, [train_length - 5000, 5000],             generator=torch.Generator().manual_seed(0))         loader = DataLoader(             dataset_val,             batch_size=self.batch_size,             num_workers=1,             drop_last=True,             pin_memory=True,         )<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 Trainer, \u043e\u0431\u0443\u0447\u0438\u043c \u043c\u0435\u0434\u0435\u043b\u044c:<\/p>\n<pre><code class=\"python\">model = LightningMNISTClassifier(config, data_dir=\".\/\")  trainer = pl.Trainer(max_epochs=10) trainer.fit(model)<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e \u043d\u0430 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435. \u0420\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f GPU \u0438 Ray Lightning.<\/p>\n<h2>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435<\/h2>\n<p>\u0420\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u044f\u0434\u0440\u0430\u043c\u0438 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 RayPlugin \u0432 Trainer \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0432 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b:<\/p>\n<pre><code class=\"python\">import ray from ray_lightning import RayPlugin  class LightningMNISTClassifier(...):    # ... etc  # variables for Ray around parallelism and hardware num_workers = 8 use_gpu = False  # Initialize ray. ray.init()  model = LightningMNISTClassifier(config, data_dir)  trainer = pl.Trainer(     max_epochs=10,      plugins=[RayPlugin(num_workers=num_workers, use_gpu=use_gpu)]) trainer.fit(model)<\/code><\/pre>\n<p>\u0421\u043d\u043e\u0432\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 8 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432.<\/p>\n<h2>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u0443\u0437\u043b\u043e\u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Ray<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438 \u0438 \u0443\u0437\u043b\u0430\u043c\u0438, \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432 Ray \u0441 RayPlugin. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440:<\/p>\n<pre><code class=\"python\">ray up cluster.yaml<\/code><\/pre>\n<p>\u0412 file_mounts \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 pip \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 setup_commands. \u041f\u043e\u043b\u043d\u043e\u0435 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u0441\u043e \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0444\u0430\u0439\u043b\u0430 YAML, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <a href=\"https:\/\/docs.ray.io\/en\/master\/cluster\/cloud.html\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440, \u043f\u043e SSH \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u043c\u0443 \u0443\u0437\u043b\u0443:<\/p>\n<pre><code class=\"bash\">ray attach cluster.yaml<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 file_mounts \u0438\u0437 cluster.yaml \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u0433\u043e\u043b\u043e\u0432\u043d\u044b\u043c \u0443\u0437\u043b\u043e\u043c. \u0412 \u0442\u043e\u043c \u0436\u0435 \u043a\u043e\u0434\u0435 \u043c\u0435\u043d\u044f\u0435\u043c \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<ul>\n<li>\n<p><code>ray.init()<\/code>-> <code>ray.init(\"auto\")<\/code> \u0447\u0442\u043e\u0431\u044b Ray \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443, \u0430 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440.<\/p>\n<\/li>\n<li>\n<p><code>use_gpu<\/code> \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432 True, \u0430 \u0432 <code>num_workers<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432\/GPU.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"bash\">python train.py<\/code><\/pre>\n<p>\u041d\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0438 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044f \u043a\u043e\u0434, \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0443\u0437\u043b\u0430\u043c\u0438 \u0438 GPU.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0432\u0441\u0451 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 GPU, \u043d\u043e <a href=\"https:\/\/github.com\/ray-project\/ray_lightning\">Ray Lightning<\/a> \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u0438\u043c:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 PyTorch DDP \u0432\u0430\u043c \u043d\u0435 \u043f\u043e \u0434\u0443\u0448\u0435, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 <a href=\"https:\/\/github.com\/ray-project\/ray_lightning#horovod-plugin-on-ray\">RayHorovodPlugin<\/a> \u0441 <a href=\"https:\/\/github.com\/horovod\/horovod\">Horovod<\/a> \u0432\u043c\u0435\u0441\u0442\u043e DDP \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 <a href=\"https:\/\/github.com\/ray-project\/ray_lightning#model-parallel-sharded-training-on-ray\">RayShardedPlugin<\/a> \u2014  (\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0432 \u0441\u043c\u044b\u0441\u043b\u0435 \u043c\u043e\u0434\u0435\u043b\u044c\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441 <a href=\"https:\/\/github.com\/facebookresearch\/fairscale\">Fairscale<\/a>).<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ray-project\/ray_lightning\">Ray Lightning<\/a> \u0442\u0430\u043a\u0436\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 <a href=\"https:\/\/docs.ray.io\/en\/master\/tune\/index.html\">Ray Tune<\/a>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u043b\u043d\u043e\u043c<a href=\"https:\/\/docs.ray.io\/en\/master\/auto_examples\/using-ray-with-pytorch-lightning.html\"> \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 <\/a>\u043f\u043e Ray+PyTorch Lightning E2E.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 <a href=\"https:\/\/docs.ray.io\/en\/master\/cluster\/ray-client.html\">\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435<\/a> Ray Client. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 <a href=\"https:\/\/github.com\/ray-project\/ray_lightning#multi-node-training-from-your-laptop\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c Ray Lightning \u0432 \u0434\u0435\u043b\u0435 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c <a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_130921&amp;utm_term=cat\">\u043a\u0443\u0440\u0441\u0435 \u043f\u043e Data Science<\/a>, \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0436\u0434\u0451\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432 Machine Learning. \u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b <a href=\"https:\/\/skillfactory.ru\/catalogue?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=sf_allcourses_130921&amp;utm_term=conc\">\u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u0443\u0440\u0441\u043e\u0432<\/a>, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/35c\/37d\/04e\/35c37d04e5c6b5c4cc7376e02630846a.png\" width=\"1000\" height=\"200\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/35c\/37d\/04e\/35c37d04e5c6b5c4cc7376e02630846a.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>Data Science \u0438 Machine Learning<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/data-analyst-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=analytics_dapr_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Analyst<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/matematika-dlya-data-science#syllabus?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mat_130921&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0434\u043b\u044f Data Science\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/matematika-i-machine-learning-dlya-data-science?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_matml_130921&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0438 Machine Learning \u0434\u043b\u044f Data Science\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/data-engineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dea_130921&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e Data Engineering<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/machine-learning-i-deep-learning?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mldl_130921&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abMachine Learning \u0438 Deep Learning\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/machine-learning?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_ml_130921&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e Machine Learning<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>Python, \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 Python<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-for-web-developers?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_pws_130921&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abPython \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/frontend-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fr_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_webdev_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0412\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ios-razrabotchik-s-nulya?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_ios_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/android-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_andr_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>Java \u0438 C#<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_java_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java-qa-engineer-testirovshik-po?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_qaja_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f QA-\u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043d\u0430 JAVA<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/c-sharp-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cdev_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C#-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/game-razrabotchik-na-unity-i-c-sharp?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_gamedev_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u0433\u0440 \u043d\u0430 Unity<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041e\u0442 \u043e\u0441\u043d\u043e\u0432 \u2014 \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/algoritmy-i-struktury-dannyh?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_algo_130921&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/c-plus-plus-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cplus_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cyber-security-etichnij-haker?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_hacker_130921&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u042d\u0442\u0438\u0447\u043d\u044b\u0439 \u0445\u0430\u043a\u0435\u0440<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0410 \u0442\u0430\u043a\u0436\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/devops-ingineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_devops_130921&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e DevOps<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/577378\/\"> https:\/\/habr.com\/ru\/articles\/577378\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>PyTorch Lightning \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0442\u044c Deep Learning \u043d\u0430 GPU, \u043d\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u0432 \u0441\u0435\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 SLURM. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0440\u0435\u0448\u0430\u0435\u0442 \u043f\u0430\u043a\u0435\u0442 Ray Lightning, \u043e\u0431\u0437\u043e\u0440\u043e\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u043a \u0441\u0442\u0430\u0440\u0442\u0443 \u043f\u043e\u0442\u043e\u043a\u0430 <a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_130921&amp;utm_term=cat\">\u043a\u0443\u0440\u0441\u0430 \u043f\u043e Data Science<\/a>.<\/p>\n<hr\/>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u0438\u043c: \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0435 \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 GPU, \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0437\u0435\u043b:<\/p>\n<ul>\n<li>\n<p>\u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0438\u043c\u0435\u043b \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u0434\u0443;<\/p>\n<\/li>\n<li>\n<p>\u0438\u043c\u0435\u043b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 PyTorch;<\/p>\n<\/li>\n<li>\n<p>\u0442\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0437\u043b\u0435;<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u0432\u043e\u0442 \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438 PyTorch Lightning \u0432\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0451\u0442\u0435\u0441\u044c:<\/p>\n<ul>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u043e\u0431\u043b\u0430\u043a\u0435 (AWS, Azure, GCP \u0438\u043b\u0438 Kubernetes) \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0448\u0438\u0440\u043e\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u0435\u0442\u0435\u043d\u0446\u0438\u0439;<\/p>\n<\/li>\n<li>\n<p>\u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f Jupyter Notebook;<\/p>\n<\/li>\n<li>\n<p>\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u0437\u0430\u0442\u0440\u0430\u0442\u044b, \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0431\u0448\u0438\u0440\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043a\u043e\u0434\u0430?<\/p>\n<h2>\u0417\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 Ray Lightning<\/h2>\n<p><a href=\"https:\/\/github.com\/ray-project\/ray_lightning\">Ray Lightning<\/a> \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043b\u0430\u0433\u0438\u043d PyTorch Lightning \u0434\u043b\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0412\u043e\u0442 \u0435\u0433\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430:<\/p>\n<ul>\n<li>\n<p>\u0415\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c, \u043d\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043a\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p>\u041b\u0435\u0433\u043a\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c: \u043f\u0438\u0448\u0435\u043c \u043e\u0434\u0438\u043d \u043a\u043e\u0434 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e GPU \u0438 \u043c\u0435\u043d\u044f\u0435\u043c \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 Jupyter Notebook: \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 Ray Lightning, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c\u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438<a href=\"https:\/\/docs.ray.io\/en\/latest\/cluster\/cloud.html\"> Ray Cluster Launcher<\/a> \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043d\u0430 AWS\/Azure\/GCP.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043a\u0440\u0443\u043f\u043d\u043e\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0433\u0438\u043f\u0435\u0440\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u043d \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441<a href=\"https:\/\/docs.ray.io\/en\/latest\/tune\/index.html\"> Ray Tune<\/a> \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 SOTA. <\/p>\n<\/li>\n<li>\n<p>\u0410 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u043e\u043d \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439, \u0435\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0442\u043a\u0440\u044b\u0442!<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c Ray Lightning \u2014 <a href=\"https:\/\/ray.io\/\">Ray<\/a>, \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043d\u0430 Python.<\/p>\n<h2>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Ray Lightning?<\/h2>\n<p><a href=\"https:\/\/github.com\/ray-project\/ray_lightning\">Ray Lightning<\/a> \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 PyTorch Lightning, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c RayPlugin, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 Trainer. \u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0443 DDPSpawn, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043d\u043e\u0432\u044b\u0435 <a href=\"https:\/\/docs.ray.io\/en\/master\/actors.html\">\u0430\u043a\u0442\u043e\u0440\u044b Ray<\/a>. \u0410\u043a\u0442\u043e\u0440\u044b \u2014 \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b Python, \u043d\u043e \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Ray, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u0435 \u0432\u044b\u0445\u043e\u0434\u044f \u0438\u0437 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f Python.<\/p>\n<figure class=\"full-width\"><figcaption>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0430\u043a\u0442\u043e\u0440\u043e\u0432 Ray \u0432 \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435<\/figcaption><\/figure>\n<p>\u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u043a\u0442\u043e\u0440\u0430 \u0435\u0441\u0442\u044c \u043a\u043e\u043f\u0438\u044f LightningModule, \u0430\u043a\u0442\u043e\u0440\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0433\u0440\u0443\u043f\u043f\u0443 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f PyTorch. Ray \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 DistributedDataParallel \u0441 \u0442\u043e\u0439 \u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u043d\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e, \u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043f\u043e \u043c\u0435\u0440\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e.<\/p>\n<h2>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u043c<\/h2>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430\u043c\u0438 \u0431\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0439 \u0441 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439, \u2014 \u044d\u0442\u043e \u043c\u0443\u0447\u0435\u043d\u0438\u0435. \u041d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0441 Ray, \u0433\u0434\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c <a href=\"https:\/\/docs.ray.io\/en\/master\/cluster\/cloud.html\">\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c<\/a>.<\/p>\n<p>\u042d\u0442\u043en \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 AWS, GCP, Azure, \u0438 \u0432 \u043d\u0451\u043c \u0435\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 Kubernetes, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 Ray \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0433\u0434\u0435 \u0443\u0433\u043e\u0434\u043d\u043e. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Ray \u043a\u043e\u0434 \u043b\u0435\u0433\u043a\u043e \u043c\u0438\u0433\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u043b\u0430\u043a\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0435. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Ray \u043d\u0430 AWS, \u043d\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b YAML:<\/p>\n<pre><code class=\"yaml\">cluster_name: ml  # Cloud-provider specific configuration. provider:     type: aws     region: us-west-2     availability_zone: us-west-2a,us-west-2b  # How Ray will authenticate with newly launched nodes. auth:     ssh_user: ubuntu  head_node:     InstanceType: p3.8xlarge     ImageId: latest_dlami      # You can provision additional disk space with a conf as follows     BlockDeviceMappings:         - DeviceName: \/dev\/sda1           Ebs:               VolumeSize: 100 worker_nodes:     InstanceType: p3.2xlarge     ImageId: latest_dlami  file_mounts: {     \"\/path1\/on\/remote\/machine\": \"\/path1\/on\/local\/machine\", }  # List of shell commands to run to set up nodes. setup_commands:     - pip install -U ray-lightning<\/code><\/pre>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0432 file_mounts \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0443\u0437\u043b\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0441\u044e\u0434\u0430. \u041b\u044e\u0431\u044b\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, pip install foobar) \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0432 setup_commands. \u041e\u043d\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. <\/p>\n<p>\u0417\u0430\u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0444\u0430\u0439\u043b YAML, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c ray up cluster.yaml, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c ray attach cluster.yaml, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u043e ssh \u043a \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u043c\u0443 \u0443\u0437\u043b\u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Ray. <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435, \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u0443\u0437\u043b\u044b, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0434\u0430\u043b\u044f\u044f \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435.<\/p>\n<h2>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0432\u0441\u0451<\/h2>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 MNIST \u0432 \u043e\u0431\u043b\u0430\u043a\u0435.<\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h2>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 Ray Lightning:<\/p>\n<pre><code class=\"bash\">pip install ray-lightning<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b PyTorch Lightning \u0438 Ray.<\/p>\n<h2>\u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a PyTorch Lightning<\/h2>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u043a\u043e\u0434 PyTorch Lightning. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u2014 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 LightningModule. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 MNIST \u0438\u0437 <a href=\"https:\/\/pytorch-lightning.readthedocs.io\/en\/latest\/starter\/introduction_guide.html\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 <\/a>\u043f\u043e PyTorch Lightning:<\/p>\n<pre><code class=\"python\">import pytorch_lightning as pl import torch from torch.utils.data import random_split, DataLoader from torchvision.datasets import MNIST from torchvision import transforms  class LightningMNISTClassifier(pl.LightningModule):     def __init__(self, config, data_dir=None):         super(LightningMNISTClassifier, self).__init__()          self.data_dir = data_dir         self.lr = config[\"lr\"]         layer_1, layer_2 = config[\"layer_1\"], config[\"layer_2\"]         self.batch_size = config[\"batch_size\"]          # mnist images are (1, 28, 28) (channels, width, height)         self.layer_1 = torch.nn.Linear(28 * 28, layer_1)         self.layer_2 = torch.nn.Linear(layer_1, layer_2)         self.layer_3 = torch.nn.Linear(layer_2, 10)         self.accuracy = pl.metrics.Accuracy()      def forward(self, x):         batch_size, channels, width, height = x.size()         x = x.view(batch_size, -1)         x = self.layer_1(x)         x = torch.relu(x)         x = self.layer_2(x)         x = torch.relu(x)         x = self.layer_3(x)         x = F.softmax(x, dim=1)         return x      def configure_optimizers(self):         return torch.optim.Adam(self.parameters(), lr=self.lr)      def training_step(self, train_batch, batch_idx):         x, y = train_batch         logits = self.forward(x)         loss = F.nll_loss(logits, y)         acc = self.accuracy(logits, y)         self.log(\"ptl\/train_loss\", loss)         self.log(\"ptl\/train_accuracy\", acc)         return loss      def validation_step(self, val_batch, batch_idx):         x, y = val_batch         logits = self.forward(x)         loss = F.nll_loss(logits, y)         acc = self.accuracy(logits, y)         return {\"val_loss\": loss, \"val_accuracy\": acc}      def validation_epoch_end(self, outputs):         avg_loss = torch.stack([x[\"val_loss\"] for x in outputs]).mean()         avg_acc = torch.stack([x[\"val_accuracy\"] for x in outputs]).mean()         self.log(\"ptl\/val_loss\", avg_loss)         self.log(\"ptl\/val_accuracy\", avg_acc)      def prepare_data(self):         self.dataset = MNIST(             self.data_dir,             train=True,             download=True,             transform=transforms.ToTensor())      def train_dataloader(self):         dataset = self.dataset         train_length = len(dataset)         dataset_train, _ = random_split(             dataset, [train_length - 5000, 5000],             generator=torch.Generator().manual_seed(0))         loader = DataLoader(             dataset_train,             batch_size=self.batch_size,             num_workers=1,             drop_last=True,             pin_memory=True,         )         return loader      def val_dataloader(self):         dataset = self.dataset         train_length = len(dataset)         _, dataset_val = random_split(             dataset, [train_length - 5000, 5000],             generator=torch.Generator().manual_seed(0))         loader = DataLoader(             dataset_val,             batch_size=self.batch_size,             num_workers=1,             drop_last=True,             pin_memory=True,         )<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 Trainer, \u043e\u0431\u0443\u0447\u0438\u043c \u043c\u0435\u0434\u0435\u043b\u044c:<\/p>\n<pre><code class=\"python\">model = LightningMNISTClassifier(config, data_dir=\".\/\")  trainer = pl.Trainer(max_epochs=10) trainer.fit(model)<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e \u043d\u0430 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435. \u0420\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f GPU \u0438 Ray Lightning.<\/p>\n<h2>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435<\/h2>\n<p>\u0420\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u044f\u0434\u0440\u0430\u043c\u0438 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 RayPlugin \u0432 Trainer \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0432 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b:<\/p>\n<pre><code class=\"python\">import ray from ray_lightning import RayPlugin  class LightningMNISTClassifier(...):    # ... etc  # variables for Ray around parallelism and hardware num_workers = 8 use_gpu = False  # Initialize ray. ray.init()  model = LightningMNISTClassifier(config, data_dir)  trainer = pl.Trainer(     max_epochs=10,      plugins=[RayPlugin(num_workers=num_workers, use_gpu=use_gpu)]) trainer.fit(model)<\/code><\/pre>\n<p>\u0421\u043d\u043e\u0432\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 8 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432.<\/p>\n<h2>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u0443\u0437\u043b\u043e\u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Ray<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438 \u0438 \u0443\u0437\u043b\u0430\u043c\u0438, \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432 Ray \u0441 RayPlugin. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440:<\/p>\n<pre><code class=\"python\">ray up cluster.yaml<\/code><\/pre>\n<p>\u0412 file_mounts \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 pip \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 setup_commands. \u041f\u043e\u043b\u043d\u043e\u0435 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u0441\u043e \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0444\u0430\u0439\u043b\u0430 YAML, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <a href=\"https:\/\/docs.ray.io\/en\/master\/cluster\/cloud.html\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440, \u043f\u043e SSH \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u043c\u0443 \u0443\u0437\u043b\u0443:<\/p>\n<pre><code class=\"bash\">ray attach cluster.yaml<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 file_mounts \u0438\u0437 cluster.yaml \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u0433\u043e\u043b\u043e\u0432\u043d\u044b\u043c \u0443\u0437\u043b\u043e\u043c. \u0412 \u0442\u043e\u043c \u0436\u0435 \u043a\u043e\u0434\u0435 \u043c\u0435\u043d\u044f\u0435\u043c \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<ul>\n<li>\n<p><code>ray.init()<\/code>-> <code>ray.init(\"auto\")<\/code> \u0447\u0442\u043e\u0431\u044b Ray \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443, \u0430 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440.<\/p>\n<\/li>\n<li>\n<p><code>use_gpu<\/code> \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432 True, \u0430 \u0432 <code>num_workers<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432\/GPU.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"bash\">python train.py<\/code><\/pre>\n<p>\u041d\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0438 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044f \u043a\u043e\u0434, \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0443\u0437\u043b\u0430\u043c\u0438 \u0438 GPU.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0432\u0441\u0451 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 GPU, \u043d\u043e <a href=\"https:\/\/github.com\/ray-project\/ray_lightning\">Ray Lightning<\/a> \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u0438\u043c:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 PyTorch DDP \u0432\u0430\u043c \u043d\u0435 \u043f\u043e \u0434\u0443\u0448\u0435, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 <a href=\"https:\/\/github.com\/ray-project\/ray_lightning#horovod-plugin-on-ray\">RayHorovodPlugin<\/a> \u0441 <a href=\"https:\/\/github.com\/horovod\/horovod\">Horovod<\/a> \u0432\u043c\u0435\u0441\u0442\u043e DDP \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 <a href=\"https:\/\/github.com\/ray-project\/ray_lightning#model-parallel-sharded-training-on-ray\">RayShardedPlugin<\/a> \u2014<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-399023","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/399023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=399023"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/399023\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=399023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=399023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=399023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}