InternLM实战营第三期入门岛作业

Linux

闯关任务完成步骤

1.登录开发机 (intern-ai.org.cn),进入创建开发机页面

2.依次填写相关信息,创建开发机

3.点击ssh连接查看开发机的ssh密码

4.打开电脑的powershell,复制登陆命令,输入登陆密码,出现下面这个界面即为成功

5.使用vscode的ssh插件进行远程连接

6.创建helloworld.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()

7.运行代码

出现的页面内容:

在 Linux 中,常见的文件管理操作包括:

  • 创建文件:可以使用 touch 命令创建空文件。

  • 创建目录:使用 mkdir 命令。

  • 目录切换:使用cd命令。

  • 显示所在目录:使用pwd命令。

  • 查看文件内容:如使用 cat 直接显示文件全部内容,moreless 可以分页查看。

  • 编辑文件:如 vivim 等编辑器。

  • 复制文件:用 cp 命令。

  • 创建文件链接:用ln命令。

  • 移动文件:通过 mv 命令。

  • 删除文件:使用 rm 命令。

  • 删除目录rmdir(只能删除空目录)或 rm -r(可删除非空目录)。

  • 查找文件:可以用 find 命令。

  • 查看文件或目录的详细信息:使用ls命令,如使用 ls -l查看目录下文件的详细信息。

  • 处理文件:进行复杂的文件操作,可以使用sed命令。

python

任务一

import string
​
def wordcount(text):
    # 去掉标点符号
    text = text.translate(str.maketrans('', '', string.punctuation))
    # 转换为小写
    text = text.lower()
    # 分割成单词列表
    words = text.split()
    # 统计每个单词出现的次数
    word_count = {}
    for word in words:
        if word in word_count:
            word_count[word] += 1
        else:
            word_count[word] = 1
    return word_count
​
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.
"""
print(wordcount(text))

任务二

GIT

1.

2.个人项目

https://github.com/626394316/SCSE

  • 15
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值