1.vscode通过ssh链接云服务器
按教程https://github.com/InternLM/Tutorial/tree/camp4/docs/L0/linux
出现报错,是ssh配置原因
[23:40:18.788] Log Level: 2
[23:40:18.807] SSH Resolver called for “ssh-remote+ssh.intern-ai.org.cn”, attempt 1
[23:40:18.807] “remote.SSH.useLocalServer”: false
[23:40:18.807] “remote.SSH.useExecServer”: true
[23:40:18.808] “remote.SSH.showLoginTerminal”: false
[23:40:18.808] “remote.SSH.remotePlatform”: {}
[23:40:18.808] “remote.SSH.path”: undefined
[23:40:18.808] “remote.SSH.configFile”: undefined
[23:40:18.808] “remote.SSH.useFlock”: true
[23:40:18.808] “remote.SSH.lockfilesInTmp”: false
[23:40:18.808] “remote.SSH.localServerDownload”: auto
[23:40:18.808] “remote.SSH.remoteServerListenOnSocket”: false
[23:40:18.808] “remote.SSH.showLoginTerminal”: false
[23:40:18.808] “remote.SSH.defaultExtensions”: []
[23:40:18.808] “remote.SSH.loglevel”: 2
[23:40:18.808] “remote.SSH.enableDynamicForwarding”: true
[23:40:18.808] “remote.SSH.enableRemoteCommand”: false
[23:40:18.808] “remote.SSH.serverPickPortsFromRange”: {}
[23:40:18.808] “remote.SSH.serverInstallPath”: {}
[23:40:18.809] “remote.SSH.permitPtyAllocation”: false
[23:40:18.809] "remote.SSH.preferredLocalPortRange: undefined
[23:40:18.809] "remote.SSH.useCurlAndWgetConfigurationFiles: false
[23:40:18.814] VS Code version: 1.95.3
[23:40:18.814] Remote-SSH version: remote-ssh@0.115.1
解决如下:
首先,修改 .ssh 目录的权限:# 在Windows命令提示符(以管理员身份运行)中执行:
icacls “C:\Users\Administrator.ssh” /reset
icacls “C:\Users\Administrator.ssh” /grant:r “%USERNAME%”:“(F)”
首先,修改 .ssh 目录的权限:# 在Windows命令提示符(以管理员身份运行)中执行:
icacls “C:\Users\Administrator.ssh” /reset
icacls “C:\Users\Administrator.ssh” /grant:r “%USERNAME%”:“(F)”
2.新建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/202410081252022.png" alt="Logo" width="50%" style="border-radius: 5px;"></a></p>"""gr.Markdown(html_code)
3.安装依赖:pip install gradio==4.29.0
4.运行hello_world.py文件