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

部署常用指南

https://docs.conda.io/en/latest/miniconda.html#installing

环境配置
安装和配置 Anaconda
安装 Anaconda。
配置镜像源:
yaml

conda配置
vim ~/.condarc


channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  
创建虚拟环境
创建 Python 3.10 虚拟环境:
conda create --prefix=D:\work2\7.6\713\SalesGPT-main\Python310 python=3.10
激活虚拟环境:
D:\work2\7.6\713\SalesGPT-main\Python310\Scripts\activate
安装 PyTorch 和相关库
安装 PyTorch

https://pytorch.org/get-started/previous-versions/


安装其他库:
pip install einops auto-gptq

使用 Git
克隆 Git 仓库:
git clone git@github.com:huggingface/diffusers.git
使用 Git LFS:
git lfs install
SSH 密钥生成与配置
生成 SSH 密钥:
ssh-keygen -t rsa -b 4096 -C "248@qq.com"
将密钥添加到 GitHub。
虚拟环境操作
激活虚拟环境:
source_name\Scripts\activate  # Windows
source_name/bin/activate      # Linux/macOS
查看 Conda 版本:
conda --version
查看 pip 版本:
pip --version
查看虚拟环境列表:
conda info --envs
查看当前虚拟环境中的软件包列表:
conda list
在虚拟环境中安装软件包:
pip install package_name
在虚拟环境中导出依赖项列表:
pip freeze > requirements.txt
退出虚拟环境:
deactivate

Git 使用
提交与同步
git add .
git commit -m "Commit message"
git push origin master
克隆与分支
git clone repository_url
git checkout -b new_branch_name
登录 Hugging Face
transformers-cli login

Nginx 操作
运行 Nginx:
nginx
检查 Nginx 配置:
nginx -t -c E:\app\nginx-1.25.1\conf\nginx.conf
重新加载 Nginx 配置:
nginx -s reload
SSH 密钥和 Git 配置
生成 SSH 密钥:
ssh-keygen -t rsa -b 4096 -C "242918@qq.com"
将密钥添加到 Git 账户。

配置 Git 用户名和邮箱:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

文件编辑
使用 Nano 编辑器保存文件:
按下 Ctrl + O 保存。
确认文件名并按下 Enter。
按下 Ctrl + X 退出编辑器。

虚拟环境拷贝
1激活源虚拟环境。
2导出依赖项列表至 requirements.txt。
3创建目标虚拟环境。
4在目标虚拟环境中安装依赖项。

切换工作目录至 FastChat 项目:
cd /hy-tmp/FastChat-main
设置 Hugging Face Hub 缓存路径:
export HUGGINGFACE_HUB_CACHE="/hy-tmp/hy-tmp/"
启动 FastChat 服务,加载模型:
python3 -m fastchat.serve.cli --model-path lmsys/vicuna-13b-v1.5-16k

创建一个名为 "vits" 的新 tmux 会话:
tmux new -s vits
关闭名为 "vits" 的 tmux 会话:
tmux kill-session -t vits

tmux,它是一个终端多路复用工具,允许您在一个终端窗口中同时运行多个终端会话。

步骤 1: 下载 Anaconda 安装脚本

使用 wget 命令从指定链接下载 Anaconda 安装脚本,通过 -c 参数可以断点续传下载。

wget -c https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
步骤 2: 安装 Anaconda

在 Anaconda 安装脚本所在的目录下,运行脚本安装 Anaconda。根据提示,一路回车,直到出现输入 "yes" 的要求时。

bash Anaconda3-2021.05-Linux-x86_64.sh
步骤 3: 配置环境变量

打开 /etc/profile 文件,使用 vim 或其他编辑器进行编辑。

vim /etc/profile
在文件末尾添加环境变量配置,将 Anaconda 的 bin 文件夹路径添加到 PATH 环境变量中。

export PATH=~/anaconda3/bin:$PATH
同样,打开 ~/.bashrc 文件也添加同样的环境变量配置。

vim ~/.bashrc
在文件末尾添加:

export PATH=~/anaconda3/bin:$PATH
最后,刷新环境变量使配置生效。
source /etc/profile
source ~/.bashrc

步骤 1: 配置 pip 镜像

创建 .pip 目录并进入:

mkdir ~/.pip
cd ~/.pip/
使用编辑器(如 vim)创建并编辑 pip.conf 文件:

vim pip.conf
在 pip.conf 文件中配置镜像,将以下内容添加进去:

plaintext
Copy code
[global] 
index-url = http://mirrors.aliyun.com/pypi/simple/ 
[install] 
trusted-host=mirrors.aliyun.com
配置后,pip 将使用阿里云镜像源进行软件包的下载和安装。

步骤 2: 创建和管理虚拟环境

创建虚拟环境(以创建名为 ChatGLM 的虚拟环境为例):

conda create -n ChatGLM python==3.10
初始化 Conda 的 bash 命令(通常只需执行一次):

conda init bash
在新终端窗口中激活虚拟环境(假设虚拟环境名为 ChatGLM):

conda activate ChatGLM
步骤 3: 常用 Conda 命令

创建虚拟环境:

conda create -n name python==3.7
激活虚拟环境:

conda activate name
退出虚拟环境:

conda deactivate
查看虚拟环境列表:

conda info --envs
删除虚拟环境(以删除名为 name 的虚拟环境为例):

conda remove -n name --all
清理 Conda 安装包及缓存(索引缓存、锁定文件、未使用的包和 tar 包):

conda clean -y --all
删除 pip 的缓存:
rm -rf ~/.cache/pip

http://www.lryc.cn/news/138108.html

相关文章:

  • 4.5 TCP优化
  • pdf太大怎么压缩大小?这样压缩文件很简单
  • 【IMX6ULL驱动开发学习】09.Linux之I2C框架简介和驱动程序模板
  • 【seaweedfs】3、f4: Facebook’s Warm BLOB Storage System 分布式对象存储的冷热数据
  • 基于亚马逊云科技服务,构建大语言模型问答知识库
  • SpingMVC拦截器-用户登录权限控制分析
  • MDTA模块(Restormer)
  • C++ 新特性 | C++ 11 | decltype 关键字
  • 2023国赛数学建模思路 - 案例:退火算法
  • ubuntu20.04 编译安装运行emqx
  • ARM linux ALSA 音频驱动开发方法
  • 设计模式二十三:模板方法模式(Template Method Pattern)
  • [Linux]进程状态
  • Python爬虫逆向实战案例(五)——YRX竞赛题第五题
  • js识别图片中的文字插件 tesseract.js
  • Linux设备驱动移植(设备数)
  • 【移动端开发】鸿蒙系统开发入门:代码示例与详解
  • Jenkins的流水线详解
  • DIFFEDIT-图像编辑论文解读
  • 【优选算法】—— 字符串匹配算法
  • Docker容器:docker consul的注册与发现及consul-template守护进程
  • Blazor 依赖注入妙用:巧设回调
  • Python 基础 -- Tutorial(三)
  • 基于STM32的四旋翼无人机项目(二):MPU6050姿态解算(含上位机3D姿态显示教学)
  • 微信小程序开发教学系列(1)- 开发入门
  • Nginx虚拟主机(server块)部署Vue项目
  • JAVA开发环境接口swagger-ui使用总结
  • mongodb 数据库管理(数据库、集合、文档)
  • 分布式与集群的定义及异同
  • 电脑端teams一直在线小程序,简单好用易上手