{"id":5529,"date":"2022-05-03T13:07:20","date_gmt":"2022-05-03T05:07:20","guid":{"rendered":"https:\/\/blog.iyatt.com\/?p=5529"},"modified":"2024-05-05T14:19:06","modified_gmt":"2024-05-05T06:19:06","slug":"google-colab-%e7%9a%84%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/blog.iyatt.com\/?p=5529","title":{"rendered":"Google Colab \u7684\u4f7f\u7528"},"content":{"rendered":"\n<p>colab \u662f Google \u63d0\u4f9b\u7684\u4e00\u4e2a\u7684 jupyter \u5e73\u53f0\uff08\u5f53\u7136\u4f7f\u7528\u80af\u5b9a\u8981\u7ffb\u5899\uff09\uff0c\u63d0\u4f9b\u7684\u73af\u5883\u57fa\u4e8e Ubuntu\uff0c\u5df2\u7ecf\u9884\u88c5\u4e86\u5e38\u7528\u7684 TensorFlow \u548c PyTorch \u7b49\u6846\u67b6\uff0c\u5e76\u4e14\u63d0\u4f9b GPU \u652f\u6301\u3002\u5bf9\u4e8e\u672c\u5730\u8ba1\u7b97\u673a\u786c\u4ef6\u73af\u5883\u6bd4\u8f83\u5dee\u7684\u60c5\u51b5\u800c\u8a00\uff0c\u8fd9\u662f\u4e00\u4e2a\u7528\u4e8e\u8bad\u7ec3\u6a21\u578b\u7684\u597d\u5de5\u5177\u3002<\/p>\n\n\n\n<p>\u8981\u4f7f\u7528\u7684\u8bdd\uff0c\u5148\u767b\u5f55<a rel=\"noreferrer noopener\" href=\"https:\/\/drive.google.com\/\" target=\"_blank\">\u8c37\u6b4c\u4e91\u76d8\u786c\u76d8<\/a>\uff0c\u70b9\u65b0\u5efa-&gt;\u66f4\u591a\uff0c\u9996\u6b21\u53ef\u80fd\u6ca1\u6709 <strong>Google Colaboratory<\/strong> \uff0c\u53ef\u4ee5\u70b9\u51fb\u5173\u8054\u66f4\u591a\u5e94\u7528\uff0c\u5728\u91cc\u9762\u641c\u7d22\u6dfb\u52a0\u5c31\u884c\u3002\u901a\u8fc7\u65b0\u5efa\u53ef\u4ee5\u521b\u5efa jupyter \u7b14\u8bb0\u672c\uff08.ipynb\uff09\uff0c\u5728\u4e91\u7aef\u786c\u76d8\u4e0a\u5df2\u6709\u7684 jupyter \u7b14\u8bb0\u672c\u6587\u4ef6\u4e5f\u53ef\u4ee5\u76f4\u63a5\u6253\u5f00\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"653\" height=\"630\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2022\/05\/image.png\" alt=\"\" class=\"wp-image-5530 lazyload\" data-srcset=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2022\/05\/image.png 653w, https:\/\/blog.iyatt.com\/wp-content\/uploads\/2022\/05\/image-300x289.png 300w\" data-sizes=\"(max-width: 653px) 100vw, 653px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 653px; --smush-placeholder-aspect-ratio: 653\/630;\" \/><\/figure>\n\n\n\n<p>colab \u7684\u4f7f\u7528\u57fa\u672c\u4e0a\u548c jupyter \u76f8\u4f3c\uff0c\u4e0d\u8fc7\u6bd5\u7adf\u662f\u514d\u8d39\u7248\uff0c\u4e5f\u4e0d\u662f\u80fd\u591f\u65e0\u9650\u5236\u4f7f\u7528\u7684\uff0c\u636e\u8bf4 GPU \u5355\u6b21\u4f7f\u7528\u65f6\u957f\u4e0d\u8d85\u8fc7 12 \u5c0f\u65f6\uff0c\u6211\u4e5f\u6478\u4e0d\u51c6\uff0c\u4f3c\u4e4e\u4e0d\u5b9a\u65f6\u7684\u65ad\u5f00\uff0c\u53ef\u80fd\u770b\u786c\u4ef6\u8d44\u6e90\u4f7f\u7528\u7387\u5427\u3002<\/p>\n\n\n\n<p>\u9ed8\u8ba4\u7b14\u8bb0\u672c\u662f\u6ca1\u6709\u542f\u7528 GPU \u7684\uff0c\u5f53\u7136\u5982\u679c\u4e0d\u4f7f\u7528 GPU\uff0c\u4e5f\u5efa\u8bae\u4e0d\u8981\u5f00\u542f\uff0c\u4f7f\u7528\u65f6\u95f4\u8fc7\u591a\u4f1a\u88ab\u9650\u5236\u4f7f\u7528 GPU\uff0c\u6240\u4ee5\u771f\u6b63\u8981\u7528\u7684\u65f6\u5019\u518d\u5f00\u5427\uff0c\u4ed8\u8d39\u7528\u6237\u5f53\u6211\u6ca1\u8bf4\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2021\/10\/image-16.png\" alt=\"\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 386px; --smush-placeholder-aspect-ratio: 386\/481;\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2021\/10\/image-17.png\" alt=\"\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 401px; --smush-placeholder-aspect-ratio: 401\/268;\" \/><\/figure>\n\n\n\n<p>\u5728\u4e00\u5b9a\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u4e5f\u9700\u8981\u4e0e\u8c37\u6b4c\u4e91\u76d8\u8fdb\u884c\u4ea4\u4e92\uff0ccolab \u4e5f\u63d0\u4f9b\u4e86\u63a5\u53e3\u652f\u6301\u5c06\u4e91\u76d8\u6302\u8f7d\u5230 colab \u7cfb\u7edf\u91cc\u3002<\/p>\n\n\n\n<p>colab \u9ed8\u8ba4\u7684\u5de5\u4f5c\u8def\u5f84\u5728 <strong>\/content<\/strong>\uff0c\u6240\u4ee5\u6211\u4e00\u822c\u4e5f\u5c31\u76f4\u63a5\u6302\u8f7d\u5728\u8fd9\u4e2a\u8def\u5f84\u4e0b\uff0c\u6302\u8f7d\u4e4b\u540e\u5c31\u53ef\u4ee5\u76f4\u63a5\u5bf9\u4e91\u76d8\u8bfb\u5199\u64cd\u4f5c\u4e86<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from google.colab import drive\ndrive.mount('\/content\/yunpan')<\/pre>\n\n\n\n<p>\u9664\u4e86\u5411\u4e91\u76d8\u5199\u5165\u6587\u4ef6\uff0ccolab \u4e5f\u652f\u6301\u4e0b\u8f7d\u6587\u4ef6\uff0c\u6bd4\u5982\u8bad\u7ec3\u597d\u7684\u6a21\u578b\u6587\u4ef6\u76f4\u63a5\u4e0b\u8f7d\u5230\u672c\u5730\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from google.colab import files\nfiles.download('\u6587\u4ef6\u540d')<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>colab \u662f Google \u63d0\u4f9b\u7684\u4e00\u4e2a\u7684 jupyter \u5e73\u53f0\uff08\u5f53\u7136\u4f7f\u7528\u80af\u5b9a\u8981\u7ffb\u5899\uff09\uff0c\u63d0\u4f9b\u7684\u73af\u5883\u57fa\u4e8e Ubu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"zakra_page_container_layout":"customizer","zakra_page_sidebar_layout":"customizer","zakra_remove_content_margin":false,"zakra_sidebar":"customizer","zakra_transparent_header":"customizer","zakra_logo":0,"zakra_main_header_style":"default","zakra_menu_item_color":"","zakra_menu_item_hover_color":"","zakra_menu_item_active_color":"","zakra_menu_active_style":"","zakra_page_header":true,"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-5529","post","type-post","status-publish","format-standard","hentry","category-all"],"modified_by":"IYATT-yx","_links":{"self":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/5529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5529"}],"version-history":[{"count":0,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/5529\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}