gcp devops_将GCP AI平台笔记本用作可重现的数据科学环境

gcp devops

By: Edward Krueger and Douglas Franklin.

作者: 爱德华·克鲁格 ( Edward Krueger)和道格拉斯·富兰克林 ( Douglas Franklin) 。

In this article, we will cover how to set up a cloud computing instance to run Python with or without Jupyter Notebook. Then we show how to connect that instance to Github for a smooth cloud workflow.

在本文中,我们将介绍如何设置云计算实例以在有或没有Jupyter Notebook的情况下运行Python。 然后,我们展示了如何将该实例连接到Github,以实现流畅的云工作流程。

We utilize cloud computing instances to get flexible Python and Jupyter environments while maintaining the reproducibility of enterprise data science platforms.

我们利用云计算实例来获得灵活的Python和Jupyter环境,同时保持企业数据科学平台的可重复性。

These AI platform notebooks come configured with many data science and analytics packages, including NumPy, Pandas, Scikit-learn and TensorFlow. Typically, we would discourage the use of bloated virtual machines. However, package bloat on our analytics machine isn’t as much of a problem because we only save the result (model, data, report) for later use. Needing only this result and the few packages needed to run our model allows us to disregard the numerous packages on the VM.

这些AI平台笔记本配置了许多数据科学和分析软件包,包括NumPy,Pandas,Scikit-learn和TensorFlow。 通常,我们不鼓励使用of肿的虚拟机。 但是,由于我们只保存结果(模型,数据,报告)供以后使用,因此我们的分析机上的软件包膨胀并不是什么大问题。 只需要这个结果和运行模型所需的几个软件包,就可以忽略VM上的众多软件包。

For example, in this Medium article, we push an NLP mode to the cloud without having to worry about dependencies.

例如,在这篇中型文章中,我们将NLP模式推到了云端,而不必担心依赖关系。

Note that AI platform notebooks have all of the client packages for GCP services installed and are already authenticated to allow easy access to anything within the same GCP project. Additionally, this platform gives us not just access to Jupyter Notebooks, but also a Python console and a CLI where we can run BASH commands.

请注意,AI平台笔记本电脑已安装了所有用于GCP服务的客户端软件包,并且已经过身份验证,可以轻松访问同一GCP项目中的任何内容。 此外,该平台使我们不仅可以访问Jupyter Notebook,而且还可以使用Python控制台和CLI来运行BASH命令。

取得GCP帐户 (Getting a GCP account)

Google’s AI Platform Notebooks offer a JupyterLab and Python environment for data scientists and machine learning developers to experiment, develop, and deploy models into production. Users can create instances running JupyterLab that come pre-installed with common packages.

Google的AI平台笔记本为数据科学家和机器学习开发人员提供JupyterLab和Python环境,以进行实验,开发并将模型部署到生产中。 用户可以创建预装有通用软件包的运行JupyterLab的实例。

Before we can set up an AI Platform Notebook, we will have to set up an account and billing, don’t worry new users get $300 in free credits!

在我们设置AI Platform Notebook之前,我们必须先设置一个帐户并进行结算,不要担心新用户将获得300美元的免费积分!

Visit GCP AI Platform and click ‘go to console.’

访问GCP AI平台 ,然后单击“转到控制台”。

Be sure to click ‘Enable API’ below to access notebooks.

确保单击下面的“启用API”以访问笔记本。

Image for post
Enable API
启用API

Once we have billing set up, we can start a project.

设置好帐单后,我们可以开始一个项目。

启动您的第一个GCP AI Platform Notebook实例 (Starting up your first GCP AI Platform Notebook Instance)

Now we need to select the hardware we want our virtual machine to run on. Be sure to set up the cheapest machine possible if you are testing this out!

现在,我们需要选择要在其上运行虚拟机的硬件。 如果要进行测试,请务必设置最便宜的机器!

Once we have the API enabled, the popup selections will change to those seen below, click ‘Go to instances page’ to get started.

启用API后,弹出式菜单选择将变为以下所示,单击“转到实例页面”开始使用。

Image for post
Click GO TO INSTANCES PAGE
单击转到实例页面

The instances page might have you select ‘Enable API’ another time, be sure to do so. Then click on the ‘New Instance’ button and select ‘Python 2 and 3.’

实例页面可能会让您再次选择“启用API”,请务必选择。 然后点击“新实例”按钮并选择“ Python 2和3”。

Image for post
Notebook Instances
笔记本实例

This will open up an options menu where you’ll input the region you’d like to use. Note that different regions can have different pricing. Once you have a region selected, you will want to click ‘Customize’ and select the machine with the least RAM to have the lowest cost. In our case, it is the ‘n1-standard-1’ VM with 3.75GB of RAM.

这将打开一个选项菜单,您可以在其中输入要使用的区域。 请注意,不同地区的定价可能不同。 选定区域后,将需要单击“自定义”,然后选择RAM最少的机器以降低成本。 在我们的案例中,它是具有3.75GB RAM的“ n1-standard-1” VM。

This instance will only generate fees when it is running and can be easily paused at any time! If needed, you can swap out hardware with the dropdown menus seen below while the instance is paused.

该实例仅在运行时才会产生费用,并且可以随时轻松暂停! 如果需要,您可以在实例暂停时通过下面显示的下拉菜单交换硬件。

Image for post
Selecting a low-cost machine
选择低成本机器

Now we can use SSH to connect our VM to GitHub to allow us to push and pull to our repositories with ease.

现在,我们可以使用SSH将虚拟机连接到GitHub,从而使我们可以轻松地push存储库pushpull

设置SSH (Setting Up SSH)

Be aware you will only have to do this once per instance.

请注意,每个实例只需执行一次。

使用SSH连接到GitHub (Connecting to GitHub with ssh)

  1. Generate an ssh key by running ssh-keygen and accepting the defaults by leaving them blank and pressing the enter key. This command generates files at user/.ssh/id_rsa that you’ll need to enter into GitHub.

    通过运行ssh-keygen生成ssh密钥,并通过将其保留为空白并按Enter键来接受默认值。 此命令在user/.ssh/id_rsa处生成文件,您需要将这些文件输入GitHub。

Image for post
ssh-keygen
ssh-keygen

2. Copy your public key to your clipboard. One way to do this is by running cat ~/.ssh/id_rsa.pub to return the public key text into your console, display its contents, and then copy with the mouse and keyboard.

2.将您的公钥复制到剪贴板。 一种方法是运行cat ~/.ssh/id_rsa.pub将公钥文本返回到控制台,显示其内容,然后使用鼠标和键盘进行复制。

Image for post
using cat to get our key
用猫拿到我们的钥匙

3. Go to github.com and sign in.

3.转到gi​​thub.com并登录。

4. Click your profile image in the top right and then click “Settings.”

4.单击右上角的个人资料图片,然后单击“设置”。

5. On the left-hand side, click “SSH and GPG keys.”

5.在左侧,单击“ SSH和GPG密钥”。

6. On the top right, click “New SSH key.”

6.在右上方,单击“新建SSH密钥”。

7. Set the title to whatever you like. The “Title” is your choice, but it will help you identify what computer this authorization authorizes. Paste the copied key into the “Key” field and press “Add SSH key.”

7.将标题设置为任何您喜欢的名称。 您可以选择“标题”,但这将帮助您确定此授权授权的计算机。 将复制的密钥粘贴到“密钥”字段中,然后按“添加SSH密钥”。

Image for post

8. Go back to your computer and run eval 'ssh-agent -s' to start your ssh authentication agent.

8.返回计算机并运行eval 'ssh-agent -s'以启动ssh身份验证代理。

Image for post
Steps 8 and 9 adding our ssh-key
步骤8和9添加我们的ssh-key

9. Run ssh-addto add your private key so that the agent can authenticate the public key.

9.运行ssh-add添加您的私钥,以便代理可以验证公钥。

10. Set your git configuration so that GitHub knows who you are by running git config --global user.email you@email.com and git config --global user.name username, where the email and username are those attached to your GitHub account.

10.设置您的git配置,以便GitHub通过运行git config --global user.email you@email.comgit config --global user.name username知道您的git config --global user.name username ,其中电子邮件和用户名是附加到GitHub上的电子邮件和用户名帐户。

Now you can git clone any repository you have access too right onto the VM, make changes to the code, and push them back to the repository!

现在,您可以git clone任何有权访问的存储库直接git clone到VM上,对代码进行更改,然后将其推回到存储库中!

结论 (Conclusion)

We’ve discussed how to set up a cloud computing instance to run Python, BASH, and Jupyter Notebooks and how to connect that instance to Github for an easy and secure cloud workflow.

我们已经讨论了如何设置一个云计算实例来运行Python,BASH和Jupyter Notebook,以及如何将该实例连接到Github,以实现简单而安全的云工作流程。

This workflow is great because it is so reproducible! Teams using VMs like this will encounter less of the ‘it works on my machine’ bugs. Using ssh to connect the cloud VM and our remote repositories provide a safe connection to protect your data. Additionally, if you want to run code on expensive hardware, you don’t have to buy that hardware! Instead, run what you need and pause your instance to save costs.

这个工作流程很棒,因为它是如此的可复制! 使用此类VM的团队将遇到较少的“在我的计算机上运行”错误。 使用ssh连接云VM和我们的远程存储库可提供安全的连接来保护您的数据。 此外,如果您想在昂贵的硬件上运行代码,则不必购买该硬件! 而是运行所需的内容并暂停实例以节省成本。

We hope this guide has been helpful and that your coding skills are leveling up with us!

我们希望本指南对您有所帮助,并且您的编码技能正在与我们一起发展!

翻译自: https://towardsdatascience.com/using-gcp-ai-platform-notebooks-as-reproducible-data-science-environments-964cba32737

gcp devops

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/392510.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

迅为工业级iMX6Q开发板全新升级兼容PLUS版本|四核商业级|工业级|双核商业级...

软硬件全面升级 1. 新增Yocto项目的支持 增加opencv等软件功能 2. 新近推出i.MX6增强版本核心板(PLUS) -性能更强 四种核心板全兼容 四核商业级2G/16G;双核商业级1G/8G ;四核工业级1G/8G ;四核增强版(PLUS) 3. 豪华配…

flume 中的 hdfs sink round 和roll

http://blog.csdn.net/kntao/article/details/49278239 http://flume.apache.org/FlumeUserGuide.html#exec-source 默认的是是SequenceFile所以数据存在hdfs上通过命令查看的时候会是乱码,如果此时需要修改filetype和writeFormat来修改 hdfs.fileTypeSequenceFileFile format:…

leetcode 649. Dota2 参议院(贪心算法)

Dota2 的世界里有两个阵营:Radiant(天辉)和 Dire(夜魇) Dota2 参议院由来自两派的参议员组成。现在参议院希望对一个 Dota2 游戏里的改变作出决定。他们以一个基于轮为过程的投票进行。在每一轮中,每一位参议员都可以行使两项权利中的一项: …

电力现货市场现货需求_现货与情绪:现货铜市场中的自然语言处理与情绪评分

电力现货市场现货需求Note from Towards Data Science’s editors: While we allow independent authors to publish articles in accordance with our rules and guidelines, we do not endorse each author’s contribution. You should not rely on an author’s works with…

PHP学习系列(1)——字符串处理函数(2)

6、chunk_split() 函数把字符串分割为一连串更小的部分。本函数不改变原始字符串。 语法:chunk_split(string,length,end) 参数: string——必需。规定要分割的字符串。 length——可选。一个数字,定义字符串块的长度。 end——可选。字符串值…

java做主成分分析_主成分分析PCA

PCA(Principal Component Analysis),即主成分分析,一种常用于数据降维分析的方法。要理解PCA的原理,首先需要理解矩阵变换的意义。矩阵变换,有两种意义:1,在当前坐标系下的向量,经过矩阵M变换后…

个人学习进度(第十六周)

转载于:https://www.cnblogs.com/lhj1017/p/7011993.html

什么叫静态构建版本号码_为什么要使用GatsbyJS构建静态网站

什么叫静态构建版本号码by Ajay NS由Ajay NS 为什么要使用GatsbyJS构建静态网站 (Why you should use GatsbyJS to build static sites) Gatsby has been growing over time, and I’m glad to see it in use by a huge number of sites like marketing sites, blogs, and gen…

leetcode 217. 存在重复元素

给定一个整数数组,判断是否存在重复元素。 如果任意一值在数组中出现至少两次,函数返回 true 。如果数组中每个元素都不相同,则返回 false 。 示例 1: 输入: [1,2,3,1] 输出: true 代码 class Solution {public boolean containsDuplica…

C#正则表达式提取HTML中IMG标签的URL地址 .

/// <summary> /// 取得HTML中所有图片的 URL。 /// </summary> /// <param name"sHtmlText">HTML代码</param> /// <returns>图片的URL列表</returns> public static string[] GetHtmlImageUrlList(string sHtmlText) { // 定…

java datarow 使用_DataRow中的链接(数据表)

我正在动态构建一个DataTable&#xff0c;我正在尝试在DataRow中添加一个“链接”&#xff0c;我将其添加到DataTable中 . DataTable在创建后绑定到GridView .像这样的东西&#xff1a;DataTable dataTable new DataTable();foreach (Item item in items){DataRow row dataTa…

mac、windows如何强制关闭tomcat进程

方式1.打开cmd&#xff0c;或mac的终端&#xff0c;输入&#xff1a;① ps aux | grep "tomcat"&#xff0c;找到响应的进程id&#xff1b;② kill -9 查询的id&#xff0c;来强制关闭进程方式2&#xff1a;window&#xff0c;打开tomcat文件夹 --> bin --> sh…

用python绘制箱线图_用卫星图像绘制世界海岸线图-第一部分

用python绘制箱线图At the UKHO, we use data science to gain valuable insight into the data sets we hold and further our understanding of the marine environment around us.在UKHO&#xff0c;我们使用数据科学获得对所拥有数据集的宝贵见解&#xff0c;并进一步了解周…

vue 递归创建菜单_如何在Vue中创建类似中等的突出显示菜单

vue 递归创建菜单by Taha Shashtari由Taha Shashtari 如何在Vue中创建类似中等的突出显示菜单 (How to Create a Medium-Like Highlight Menu in Vue) A cool feature in Medium is the highlight menu that pops up when you select some text. This menu contains buttons t…

leetcode 376. 摆动序列(dp)

如果连续数字之间的差严格地在正数和负数之间交替&#xff0c;则数字序列称为摆动序列。第一个差&#xff08;如果存在的话&#xff09;可能是正数或负数。少于两个元素的序列也是摆动序列。 例如&#xff0c; [1,7,4,9,2,5] 是一个摆动序列&#xff0c;因为差值 (6,-3,5,-7,3…

在ASP.NET Atlas中调用Web Service——创建Mashup调用远端Web Service(基础知识以及简单示例)...

作者&#xff1a;Dflying Chen &#xff08;http://dflying.cnblogs.com/&#xff09; 注&#xff1a;Atlas中的Mashup极其复杂&#xff0c;其中涉及众多的对象与架构&#xff0c;为了写这篇文章&#xff0c;我花了不少时间学习研究。同时&#xff0c;关于这方面资源的匮乏简直…

java弹框形式输入_java中点击一个按钮弹出两个输入文本框的源代码

展开全部写了一个很简单的案例,可以参考和修改import java.awt.BorderLayout;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JFrame;import…

sap wm内向交货步骤_内向型人在数据科学中成功的五个有效步骤

sap wm内向交货步骤Just like most attributes of humans, including both the bright and dark sides, being an introvert is no exception. This article was not written to inspire you as most articles about data science or engineering do. What we want is that by …

C# 学习之路--百度网盘爬虫设计与实现(一)

百度网盘爬虫 现在市面上出现了很多网盘搜索引擎&#xff0c;写这系列博文及爬虫程序的初衷&#xff1a; 更方面的查找资源学习C#学习爬虫的设计与实现记录学习历程自我监督 能力有限&#xff0c;如有不妥之处&#xff0c;还请各位看官点评。同在学习的网友~与君共勉。工具/库选…

实习生对企业的认识_如何成为您认识的超级明星实习生

实习生对企业的认识by Maple Ong由Maple Ong 如何成为您认识的超级明星实习生 (How to be The Superstar Intern You Know You Are) 遏制冒名顶替综合症&#xff0c;为即将到来的软件工程实习做准备 (Curb the Impostor Syndrome and get prepared for your upcoming Software…