{"id":298905,"date":"2020-02-19T09:00:12","date_gmt":"2020-02-19T09:00:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=298905"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=298905","title":{"rendered":"\u041c\u043e\u043b\u0447\u0430\u043d\u0438\u0435 \u0432\u0435\u043d\u0442\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432. Google Colab, Javascript \u0438 TensorflowJS"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/avito\/blog\/488936\/\">\n<p>Google Colab&nbsp;\u2014&nbsp;\u044d\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430&nbsp;\u043e\u0441\u043d\u043e\u0432\u0435 Jupyter Notebook. Google Colab \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f&nbsp;\u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u044f\u043c\u043e \u0432&nbsp;\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0434\u0430\u0451\u0442 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a&nbsp;\u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u043c GPU \u0438 TPU. \u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0443, \u0447\u0442\u043e \u0443&nbsp;\u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f production. <\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Google Colab \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0437\u0430&nbsp;\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u041e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 Python (2\/3) \u0438\u0437&nbsp;\u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0432\u0441\u0451 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u0432\u0435\u0440\u043d\u043e?<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sw\/dm\/fo\/swdmfogkv4gb7f3occoxe3tumei.png\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"net-ya-hochu-javascript\">\u041d\u0435\u0442! \u042f \u0445\u043e\u0447\u0443 JavaScript<\/h2>\n<p>  <\/p>\n<p>\u0418 \u044d\u0442\u043e, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, <a href=\"https:\/\/habr.com\/ru\/company\/avito\/blog\/470904\/\">\u043d\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437<\/a>, \u043a\u043e\u0433\u0434\u0430 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0445 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439 \u043d\u0430 JavaScript. \u041d\u043e \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430&nbsp;\u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0431\u0435\u0437\u0443\u043c\u043d\u0430\u044f \u0438\u0434\u0435\u044f, \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u0412 Google Colab \u043d\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 JavaScript. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u044f \u0441\u043c\u043e\u0433 \u00ab\u0432\u0437\u043b\u043e\u043c\u0430\u0442\u044c\u00bb \u0435\u0433\u043e. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u043c, \u043f\u0440\u043e\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u043c <a href=\"https:\/\/github.com\/googlecolab\/colabtools\/issues\/13\">\u0432&nbsp;\u044d\u0442\u043e\u043c issue<\/a> \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c JavaScript \u0441\u043d\u0438\u043f\u043f\u0435\u0442\u0430\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u043a\u0440\u0435\u0441\u0442\u0438\u0442\u044c Google Colab c&nbsp;TensorflowJs.<\/p>\n<p>  <\/p>\n<h2 id=\"bystryy-start\">\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0447\u0430\u0442\u044c, \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0448\u0430\u0431\u043b\u043e\u043d. \u041f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 <a href=\"https:\/\/colab.research.google.com\/gist\/obenjiro\/7f1499520458fdb06fdf48086c9be50a\">\u044d\u0442\u0443 \u0441\u0441\u044b\u043b\u043a\u0443<\/a> \u0438 \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0439\u0442\u0435 \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0430&nbsp;Google \u0414\u0438\u0441\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b &quot;Save a copy in Drive&quot;.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qo\/jh\/2n\/qojh2naofattaauigp91e5vlst0.png\"><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043f\u0438\u044f Jupyter Notebook \u043d\u0430&nbsp;\u0432\u0430\u0448\u0435\u043c Google \u0414\u0438\u0441\u043a\u0435. \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u0434 \u0438\u0437&nbsp;\u0441\u0435\u043a\u0446\u0438\u0438 &quot;Prep JS runtime for Google Colab&quot;, \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438 \u0432\u0441\u0451, \u0432\u0430\u0448 JavaScript Jupyter Notebook \u0433\u043e\u0442\u043e\u0432 \u043a&nbsp;\u0440\u0430\u0431\u043e\u0442\u0435! <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9a6\/527\/96a\/9a652796a948c53e2c21a4ec6ae315cf.gif\" alt=\"Alt Text\"><\/p>\n<p>  <\/p>\n<h2 id=\"kak-eto-rabotaet\">\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h2>\n<p>  <\/p>\n<p>\u0412&nbsp;\u0448\u0430\u0431\u043b\u043e\u043d\u0435 Jupyter Notebook \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043e \u044f\u0434\u0440\u043e <a href=\"https:\/\/gist.github.com\/obenjiro\/7f1499520458fdb06fdf48086c9be50a?short_path=2c913b9#file-tfjs-mninst-colab-ipynb-L10\">javascript<\/a>. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430&nbsp;\u043c\u0430\u0448\u0438\u043d\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0430\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0430, \u043d\u0435\u0442 \u044d\u0442\u043e\u0433\u043e \u044f\u0434\u0440\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438&nbsp;\u0441\u0442\u0430\u0440\u0442\u0435 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: &quot;Unrecognized runtime javascript; defaulting to python&quot;. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/22b\/1a1\/3e4\/22b1a13e491bbc2e7c2f67e4c6c5404c.png\" alt=\"Alt Text\"><\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043a\u043e\u0434 \u0432&nbsp;\u0441\u0435\u043a\u0446\u0438\u0438 &quot;Prep JS runtime for Google Colab&quot;, \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c ijavascript. \u042d\u0442\u043e \u044f\u0434\u0440\u043e \u0434\u043b\u044f&nbsp;Jupyter Notebook, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 JavaScript. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441&nbsp;\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u043d\u0430&nbsp;\u0438\u0445 <a href=\"https:\/\/github.com\/n-riesco\/ijavascript\">GitHub \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">!npm install -g npm@latest !npm cache verify !npm install -g --unsafe-perm ijavascript !ijsinstall --install=global !jupyter-kernelspec list<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u043c\u044b \u0432\u044b\u043d\u0443\u0436\u0434\u0430\u0435\u043c Google Colab \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u044f\u0434\u0440\u043e <code>javascript<\/code> \u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0438\u0440 JavasScript \u0438 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h2 id=\"ispravlenie-problem\">\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c<\/h2>\n<p>  <\/p>\n<h4 id=\"ubedites-chto-yadro-ustanovilos\">\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u044f\u0434\u0440\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c<\/h4>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443, \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430: <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"> javascript    \/usr\/local\/share\/jupyter\/kernels\/javascript<\/code><\/pre>\n<p>  <\/p>\n<p>Google Colab \u0438\u043c\u0435\u0435\u0442 \u0442\u0435\u043d\u0434\u0435\u043d\u0446\u0438\u044e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u043b\u044b, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u0441\u0451 \u0441\u043b\u043e\u043c\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<h4 id=\"v-yadre-ijavascript-net-prostogo-i-ponyatnogo-sposoba-vypolneniya-komand-obolochki\">\u0412 \u044f\u0434\u0440\u0435 ijavascript \u043d\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438<\/h4>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041d\u0430\u0439\u0442\u0438 \u0435\u0451 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/colab.research.google.com\/gist\/obenjiro\/7f1499520458fdb06fdf48086c9be50a\">\u0432&nbsp;\u0448\u0430\u0431\u043b\u043e\u043d\u0435<\/a>.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">var { spawn } = require('child_process'); var sh = (cmd) =&gt; {    $$.async();    var sp = spawn(cmd, { cwd: process.cwd(), stdio: 'pipe', shell: true, encoding: 'utf-8' });    sp.stdout.on('data', data =&gt; console.log(data.toString()));    sp.stderr.on('data', data =&gt; console.error(data.toString()));    sp.on('close', () =&gt; $$.done()); };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c package.json, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u0430\u043d\u0434.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">sh('npm init -y'); sh('node -v; npm -v'); sh('npm install @tensorflow\/tfjs-node-gpu');<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"ne-ispolzuyte-let-const\">\u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>let, const<\/code><\/h4>\n<p>  <\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 <code>var<\/code>. \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0430\u0436\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 Jupyter Notebook \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043a\u043e\u0434 \u0432&nbsp;\u043b\u044e\u0431\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441&nbsp;\u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>let<\/code> \u0438\u043b\u0438 <code>const<\/code> \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f&nbsp;\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0441\u0442\u043e\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b <code>$$.async()<\/code>, <code>$$.done()<\/code>. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432\u0430\u0448 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">var run_async = async (pf) =&gt; {  $$.async();  await pf();  $$.done(); };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">var data; \/\/ may take a lot of time to download files for the first time run_async(async function () {  data = new MnistDataset();  await data.loadData();  \/\/ async code that fetches MNINST dataset  console.log(data.getTrainData()); })<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"limity-google-colab\">\u041b\u0438\u043c\u0438\u0442\u044b Google Colab<\/h4>\n<p>  <\/p>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u0430\u0448\u0443 \u043c\u0430\u0448\u0438\u043d\u0443 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u0442 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/research.google.com\/colaboratory\/faq.html#resource-limits\">Google Colab<\/a>), \u0438 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0439 javascript, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431&nbsp;\u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043a\u043e\u0434\u0430. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u0430\u043c \u0432\u044b\u0434\u0435\u043b\u0438\u043b\u0438 \u043d\u043e\u0432\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u0434 \u0438\u0437&nbsp;\u0441\u0435\u043a\u0446\u0438\u0438 &quot;Prep JS runtime for Google Colab&quot; \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443.<\/p>\n<p>  <\/p>\n<h4 id=\"mashiny-bez-gpu\">\u041c\u0430\u0448\u0438\u043d\u044b \u0431\u0435\u0437 GPU<\/h4>\n<p>  <\/p>\n<p>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439\u0442\u0435, \u0447\u0442\u043e \u0432\u0430\u0448\u0430 \u043c\u0430\u0448\u0438\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 GPU. \u041a&nbsp;\u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0438\u043d\u043e\u0433\u0434\u0430 Google Colab \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0434\u0430\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u0443 \u0431\u0435\u0437&nbsp;GPU. \u041c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">var tf = require('@tensorflow\/tfjs-node-gpu'); console.log(tf.backend().isUsingGpuDevice);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432 \u043b\u043e\u0433\u0430\u0445 \u0435\u0441\u0442\u044c <code>true<\/code>. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c Runtime Type \u0441&nbsp;GPU \u043d\u0430&nbsp;TPU \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432&nbsp;\u043c\u0435\u043d\u044e Runtime \u2192 Change Runtime Type. <\/p>\n<p>  <\/p>\n<h2 id=\"pochemu-javascript\">\u041f\u043e\u0447\u0435\u043c\u0443 JavaScript<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u0447\u0438\u043d, \u043f\u043e&nbsp;\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e JavaScript (TensorflowJS) \u0434\u043b\u044f&nbsp;\u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>JavaScript \u2014 \u0441\u0430\u043c\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u044f\u0437\u044b\u043a \u0432&nbsp;\u043c\u0438\u0440\u0435 \u043f\u043e&nbsp;\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 GitHub \u0438 StackOverflow.<\/li>\n<li>TensorflowJS <a href=\"https:\/\/blog.tensorflow.org\/2020\/01\/run-tensorflow-savedmodel-in-nodejs-directly-without-conversion.html?m=1\">\u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0445\u0443\u0436\u0435 \u043f\u043e&nbsp;\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/a>, \u0430 <a href=\"https:\/\/twitter.com\/jason_mayes\/status\/1228077414560878597\">\u0438\u043d\u043e\u0433\u0434\u0430 \u0434\u0430\u0436\u0435 \u0431\u044b\u0441\u0442\u0440\u0435\u0435<\/a>, \u0447\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044f Tensorflow (Python).<\/li>\n<li>\u0421&nbsp;\u043f\u043e\u043c\u043e\u0449\u044c\u044e JavaScript \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c 20\u201430 \u043a\u0430\u0434\u0440\u043e\u0432 \u0432&nbsp;\u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u0434\u043b\u044f&nbsp;\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446 \u0438 <a href=\"https:\/\/twitter.com\/TensorFlow\/status\/1214290578374041600?s=20\">\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u043c\u0438 \u0441\u043e&nbsp;\u0432\u0441\u0435\u043c\u0438 \u0432&nbsp;\u043c\u0438\u0440\u0435<\/a>, \u043d\u0435 \u043f\u043e\u043a\u0443\u043f\u0430\u044f \u043f\u0440\u0438&nbsp;\u044d\u0442\u043e\u043c \u0431\u0435\u0437\u0443\u043c\u043d\u043e \u0434\u043e\u0440\u043e\u0433\u043e\u0435 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0435. <\/li>\n<li>\u0415\u0441\u0442\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0443\u0441\u0441\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e <a href=\"https:\/\/t.me\/tensorflow_js\">TensroflowJS<\/a> \u0432&nbsp;\u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 200&nbsp;\u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0438 \u0440\u0430\u0441\u0442\u0451\u0442. <\/li>\n<li>JavaScript \u2014 \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u043a\u0440\u0443\u0442\u043e\u0439 \u044f\u0437\u044b\u043a \ud83d\ude42<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"vnbspchyom-vygoda\">\u0412&nbsp;\u0447\u0451\u043c \u0432\u044b\u0433\u043e\u0434\u0430<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0442\u0440\u0430\u0434\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u0438 \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u0438? \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u043e\u0431\u0443\u0447\u0430\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 \u043d\u0430&nbsp;\u0441\u0432\u043e\u0451\u043c MacBook\/PC? \u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0432&nbsp;\u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u0434\u043b\u044f&nbsp;\u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a MNIST \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 CNN, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432&nbsp;3\u20147 \u0440\u0430\u0437. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0ec\/402\/a34\/0ec402a3463b99cf6bbfebd4cb7d9b5a.png\" alt=\"\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0443 \u0438 \u0432&nbsp;\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0441\u0447\u0451\u0442\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044f \u0432\u0435\u043d\u0442\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432&#8230;<\/p>\n<p>  <\/p>\n<p>PS: \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043b\u0430\u0439\u043a, \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0431\u043b\u043e\u0433 \u0410\u0432\u0438\u0442\u043e \u0438 \u043c\u043e\u0439 Telegram \u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/obenjiro_notes\">Obenjiro \u2014 \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430<\/a><\/p>\n<\/div>\n<p> \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\/company\/avito\/blog\/488936\/\"> https:\/\/habr.com\/ru\/company\/avito\/blog\/488936\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/avito\/blog\/488936\/\">\n<p>Google Colab&nbsp;\u2014&nbsp;\u044d\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430&nbsp;\u043e\u0441\u043d\u043e\u0432\u0435 Jupyter Notebook. Google Colab \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f&nbsp;\u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u044f\u043c\u043e \u0432&nbsp;\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0434\u0430\u0451\u0442 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a&nbsp;\u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u044b\u043c GPU \u0438 TPU. \u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0443, \u0447\u0442\u043e \u0443&nbsp;\u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f production. <\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Google Colab \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0437\u0430&nbsp;\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u041e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 Python (2\/3) \u0438\u0437&nbsp;\u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0432\u0441\u0451 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u0432\u0435\u0440\u043d\u043e?<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sw\/dm\/fo\/swdmfogkv4gb7f3occoxe3tumei.png\"><\/p>\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-298905","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/298905","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=298905"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/298905\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=298905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=298905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=298905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}