书生实战营-LLM实战笔记

训练营非常好,有个github上的tutorial

Tutorial/docs/L0/Linux/readme.md at camp3 · InternLM/Tutorial · GitHub

第1关卡  linux 的基础知识

https://github.com/InternLM/Tutorial/blob/camp3/docs/L0/Linux/readme.md#linuxinternstudio-%E5%85%B3%E5%8D%A1

 

非常详细


1. 快速从本地上传文件:
   scp -o StrictHostKeyChecking=no -r -P {端口} {本地目录} root@ssh.intern-ai.org.cn:{开发机目录}
   *注:在开发机 SSH 连接功能查看端口号 

2. 避免因终端关闭或 SSH 连接断开导致任务终止, 强烈建议使用 tmux 将实验进程与终端窗口分离:
   https://www.ruanyifeng.com/blog/2019/10/tmux.html

3. 查看 GPU 显存和算力使用率: studio-smi 

4. 使用InternStudio开箱即用的conda环境:
   studio-conda -h

5. 将conda环境一键添加到jupyterlab:
   lab add {YOUR_CONDA_ENV_NAME}
 

就不赘述了。

文档写的真的很好,点赞一波,都是在linux上远程的必备技能。

发现一个有用的链接

标签: linux | Mikey

第2关 python基础知识

Python实现wordcount

input

"""Hello world!  
This is an example.  
Word count is fun.  
Is it fun to count words?  
Yes, it is fun!"""

output

 

{'hello': 1,'world!': 1,'this': 1,'is': 3,'an': 1,'example': 1,'word': 1, 
'count': 2,'fun': 1,'Is': 1,'it': 2,'to': 1,'words': 1,'Yes': 1,'fun': 1  }

TIPS:记得先去掉标点符号,然后把每个单词转换成小写。不需要考虑特别多的标点符号,只需要考虑实例输入中存在的就可以。

import string

def word_count(text):
    # 去除字符串中的标点符号
    translator = str.maketrans('', '', string.punctuation)
    cleaned_text = text.translate(translator)
    
    # 将所有单词转换为小写
    lower_text = cleaned_text.lower()
    
    # 分割单词并计数
    word_counts = {}
    for word in lower_text.split():
        if word in word_counts:
            word_counts[word] += 1
        else:
            word_counts[word] = 1
    
    return word_counts

# 示例使用
input_text = "Hello world! Welcome to the world of Python. Hello, world."
result = word_count(input_text)
print(result)

使用vscode登录

请使用本地vscode连接远程开发机,将上面你写的wordcount函数在开发机上进行debug,体验debug的全流程,并完成一份debug笔记(需要截图)。

第一步ssh链接

第二步创建代码

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值