当前位置: 首页 > news >正文

专注企业网站建设优化大师电脑版官方

专注企业网站建设,优化大师电脑版官方,深圳网站建设q.479185700惠,重庆seo搜索引擎优化优与略入门岛作业 Linux闯关任务:完成 SSH 连接与端口映射并运行 hello_world.py。配置vscode作业内容 可选任务1:将Linux基础命令在开发机上完成一遍作业内容 可选任务 2:使用 VSCODE 远程连接开发机并创建一个conda环境作业内容 可选任务 3&#…

入门岛作业

  • Linux
      • 闯关任务:完成 SSH 连接与端口映射并运行 hello_world.py。
          • 配置vscode
          • 作业内容
      • 可选任务1:将Linux基础命令在开发机上完成一遍
          • 作业内容
      • 可选任务 2:使用 VSCODE 远程连接开发机并创建一个conda环境
          • 作业内容
      • 可选任务 3:创建并运行test.sh文件
          • 作业内容
  • Python
      • 闯关任务:Python实现wordcount
          • 作业内容
      • 闯关任务:Vscode连接InternStudio debug笔记
          • 作业内容
  • Git
      • 任务1: 破冰活动:自我介绍
          • 作业内容
      • 任务2: 实践项目:构建个人项目
          • 作业内容

Linux

闯关任务:完成 SSH 连接与端口映射并运行 hello_world.py。

配置vscode

按照教学文档的内容来
打开vscode,在应用商店中搜索Remote-SSH并安装
打开terminal,输入ssh-keygen 创建一对钥匙
想要加密的可以输入ssh-keygen -t rsa 创建钥匙,只是我自己实践下来发现用加密的钥匙远程的时候经常提示输入密码
使用Get-Content命令查看生成的密钥并复制下来
然后去开发机平台,在首页点击配置SSH Key,接着点击添加SSH公钥,将复制的公钥粘贴到公钥框中,名称会被自动识别到,最后点击立即添加,SSH Key就配置完成了
接着新建开发机,点击SSH连接,将弹框中的命令复制下来,到vscode运行
在这里插入图片描述
登陆成功后控制台如图所示:
在这里插入图片描述

作业内容

先安装gradio
使用命令安装依赖包

pip install gradio==4.29.0

然后在Web IDE的终端中创建一个hello_world.py

vi hello_world.py

输入以下内容并保存

import socket
import re
import gradio as gr# 获取主机名
def get_hostname():hostname = socket.gethostname()match = re.search(r'-(\d+)$', hostname)name = match.group(1)return name# 创建 Gradio 界面
with gr.Blocks(gr.themes.Soft()) as demo:html_code = f"""<p align="center"><a href="https://intern-ai.org.cn/home"><img src="https://intern-ai.org.cn/assets/headerLogo-4ea34f23.svg" alt="Logo" width="20%" style="border-radius: 5px;"></a></p><h1 style="text-align: center;">☁️ Welcome {get_hostname()} user, welcome to the ShuSheng LLM Practical Camp Course!</h1><h2 style="text-align: center;">😀 Let’s go on a journey through ShuSheng Island together.</h2><p align="center"><a href="https://github.com/InternLM/Tutorial/blob/camp3"><img src="https://oss.lingkongstudy.com.cn/blog/202406301604074.jpg" alt="Logo" width="20%" style="border-radius: 5px;"></a></p>"""gr.Markdown(html_code)demo.launch()

运行python脚本

python hello_world.py

在这里插入图片描述
程序运行成功,vscode自动帮我们做了端口映射
在浏览器中打开便可以看到程序运行的结果
在这里插入图片描述

可选任务1:将Linux基础命令在开发机上完成一遍

作业内容

在这里插入图片描述
在这里插入图片描述

可选任务 2:使用 VSCODE 远程连接开发机并创建一个conda环境

当我们要使用conda安装包的时候会非常慢,我们可以设置国内镜像提升安装速度,示例如下:

#设置清华镜像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
作业内容

我们可以使用以下命令创建python版本为3.10、名字为internlm的虚拟环境

conda create -n internlm python=3.10

在这里插入图片描述

激活虚拟环境:

conda activate internlm

在这里插入图片描述

可选任务 3:创建并运行test.sh文件

作业内容

根目录下创建test.sh文件,写入以下内容:

#!/bin/bash# 定义导出环境的函数
export_env() {local env_name=$1echo "正在导出环境: $env_name"# 导出环境到当前目录下的env_name.yml文件conda env export -n "$env_name" > "$env_name.yml"echo "环境导出完成。"
}# 定义还原环境的函数
restore_env() {local env_name=$1echo "正在还原环境: $env_name"# 从当前目录下的env_name.yml文件还原环境conda env create -n "$env_name" -f "$env_name.yml"echo "环境还原完成。"
}# 检查是否有足够的参数
if [ $# -ne 2 ]; thenecho "使用方法: $0 <操作> <环境名>"echo "操作可以是 'export' 或 'restore'"exit 1
fi# 根据参数执行操作
case "$1" inexport)export_env "$2";;restore)restore_env "$2";;*)echo "未知操作: $1"exit 1;;
esac

运行test.sh

chmod +x test.sh
./test.sh export internlm
./test.sh restore internlm

在这里插入图片描述

Python

闯关任务:Python实现wordcount

实现一个 wordcount 函数,统计英文字符串中每个单词出现的次数。返回一个字典,key 为单词,value 为对应单词出现的次数。

思路:

文本转换为小写。
将所有标点符号(’s除外)转为空格。
分割文本为单词列表。
使用字典来记录单词出现的次数。

作业内容
text = """
Got this panda plush toy for my daughter's birthday,
who loves it and takes it everywhere. It's soft and
super cute, and its face has a friendly look. It's
a bit small for what I paid though. I think there
might be other options that are bigger for the
same price. It arrived a day earlier than expected,
so I got to play with it myself before I gave it
to her.
"""def wordcount(text):wordcount_result = {}text = text.lower()text = text.replace(",","").replace(".","")for t in text.split():if t not in wordcount_result.keys():wordcount_result[t] = 1else:wordcount_result[t] += 1return wordcount_resultif __name__ == '__main__':print(wordcount(text))

运行结果

{'got': 2, 'this': 1, 'panda': 1, 'plush': 1, 'toy': 1, 'for': 3, 'my': 1, "daughter's": 1, 'birthday': 1, 'who': 1, 'loves': 1, 'it': 5, 'and': 3, 'takes': 1, 'everywhere': 1, "it's": 2, 'soft': 1, 'super': 1, 'cute': 1, 'its': 1, 'face': 1, 'has': 1, 'a': 3, 'friendly': 1, 'look': 1, 'bit': 1, 'small': 1, 'what': 1, 'i': 4, 'paid': 1, 'though': 1, 'think': 1, 'there': 1, 'might': 1, 'be': 1, 'other': 1, 'options': 1, 'that': 1, 'are': 1, 'bigger': 1, 'the': 1, 'same': 1, 'price': 1, 'arrived': 1, 'day': 1, 'earlier': 1, 'than': 1, 'expected': 1, 'so': 1, 'to': 2, 'play': 1, 'with': 1, 'myself': 1, 'before': 1, 'gave': 1, 'her': 1}

闯关任务:Vscode连接InternStudio debug笔记

作业内容

打开vscode安装python插件,安装后即可打断点和debug
在这里插入图片描述
在此处打上断点,然后点击run and debug,观察分词情况
在这里插入图片描述
左上角可以看到运行这一步之前的变量的值,可以看到分词没啥问题,点击继续执行
在这里插入图片描述
debug结束
在这里插入图片描述

Git

任务1: 破冰活动:自我介绍

作业内容

自我介绍

任务2: 实践项目:构建个人项目

作业内容

个人项目

http://www.hrbkazy.com/news/26909.html

相关文章:

  • 网站制作费一般多少软文代发平台
  • wordpress取消副标题合肥seo培训
  • 如何创建百度网站西安百度seo
  • 怎么建立一个网站营销平台是什么意思
  • 简单的网站设计多少钱厦门关键词优化网站
  • 申请百度收录网址来客seo
  • 广州网站制作教程赣州seo外包怎么收费
  • 部门政府网站建设的重要意义长春关键词优化公司
  • 做问卷赚钱网站好足球排名世界排名
  • wordpress上传视频人50百度推广seo
  • 万达做的电商网站b2b采购平台
  • 做 性爱 图片网站如何免费推广自己的产品
  • 网页兼容性 网站开发2023广州疫情最新消息今天
  • 成都网站制作公司有哪些湖南网站设计外包费用
  • 国外模板网站知识营销案例
  • 用阿里云服务器做刷单网站seo短视频入口引流
  • 网站建设零金手指专业最新地址
  • 做神马网站优化百度下载安装免费版
  • 网站建设需要多久引流推广平台软件
  • 网站设计与制作合同金蝶进销存免费版
  • 网址seo查询seo英文
  • 哈尔滨网站开发渠道2023b站免费推广入口
  • 二手交易网站设计怎么做谷歌搜索入口中文
  • 网站建设优化推广百度关键词推广怎么收费
  • 网站用oracle做数据库怎么制作一个网页
  • 青岛商务学校网站建设百度公司
  • 陕西省住房城乡建设厅网站seo排名优化联系13火星软件
  • 沂南做网站哈尔滨最新疫情通报
  • 如何为网站做优化今天的新闻 最新消息摘抄
  • 网站开发部重庆网络营销