# 公共常见问题

如何还是无法解决,请企微联系海聪AI平台服务热线

# pip安装下载加速

在pip install时,加上国内源,用-i参数加:
中科大源:

pip3 install torch -i https://pypi.mirrors.ustc.edu.cn/simple/

虎牙源:

pip3 install torch -i https://pypi-proxy-prod.huya.info/simple/

# 通用外网下载加速器

# 安装海聪命令行工具

pip3 install hai --no-cache-dir -U -i https://pypi.huya.info/simple/

# 使用方法

仅需在待执行的命令前,加上 hai run 即可,比如:

#### 下载常规文件
hai run wget https://xxxx
hai run curl https://xxxx
#### 下载github/huggingface
hai run git clone xxx
#### 执行代码,加速代码里的动态下载内容
hai run python3 test.py
#### 以此类推,其它任意命令需要加速的
hai run abc xxx

注:

  • 仅在有需要时使用海聪外网加速模式,避免在拉取国内资源时也使用
  • 如果 hai run 不行,请替换为 hai run2,尝试第2种方式
  • 如果两种方式都不行,请联系 海聪AI平台 服务热线

# git仓库说明

公司的git仓库(git.huya.com)由于权限问题,从AI平台相关产品(包括notebook等)无法直接访问,请使用aigit仓库(aigit.huya.com)代替使用,方可正常访问。
具体原因是git.huya.com只能从办公网或研测网访问,而GPU等资源都在生产网,所以生产网只能访问使用aigit.huya.com这个仓库,这个仓库可以在任意网访问。

# 如何在平台自动拉取虎牙git

请按照如下操作,将您的aigit仓库,分享给hyai,然后即可在平台中创建aiflow或托管训练时使用git拉取代码

# 如果要在代码构建平台/雅典娜平台使用aigit.huya.com的代码,应该怎么办?

目前git仓库团队给的解决方案是,通过将aigit.huya.com在git.huya.com中建立一个镜像,这样子实现在海聪操作aigit.huya.com时,会自动同步到git.huya.com,然后在代码构建平台使用时,把代码路径从aigit改为git使用。
具体操作为:

  1. 假如你的aigit代码仓库为:https://aigit.huya.com/liubofang/mnist-demo ,请到 https://git.huya.com 创建一个空项目,仓库名和路径和原先尽量保持一致,比如为:https://git.huya.com/liubofang/mnist-demo
  2. 先登录你的aigit代码仓库页面,按下图所示配置
  • 其中Git repository URL的填写规范为:https://你的OA名@git.huya.com/仓库路径.git , 比如:https://liubofang@git.huya.com/liubofang/mnist-demo.git
  • Password为git密码
  1. 配置好后,首次可以先手工点击同步按钮,如下图所示,如果失败,会提示失败,鼠标放上去查看原因,如果成功,Last successful update时间会提示为Just Now
  2. 后续每次提交代码到aigit,会5分钟内自动同步到git.huya.com,可在构建平台等地方直接构建部署。

# 访问海象大数据的权限

# 获取海象Token

登陆蓝鲸:https://datacenter.huya.info/ (opens new window)
通过接口获取个人token地址:https://platform-lighthouse.huya.info/svr/auth/tempExpose.do (opens new window)

# 操作海象HDFS等

设置HADOOP_USER_NAME环境变量,dw_xxx为用户名,token为上一步获取的海象Token

// 设置环境变量
export HADOOP_USER_NAME=dw_xxx@token
// 查看海象地址
hdfs dfs -ls  hdfs://huyamlcluster/user/hive/xxxxx

# 如何手工将数据在冷热存储中互转

目前热存储为nas和cpfs,而冷存储为oss,当数据在热存储中超过3个月未访问时,会触发自动转入冷存储中,以最大限度的降低存储成本,当需要使用时,再从冷存储中恢复
这里主要说一下如何手工将数据在冷和热存储之间转移

将数据从热存储转移至冷存储
进入需要转移的热数据目录下,点右侧的转移到
选择目标冷存储oss目录,可以新建文件夹,最好保持目录结构一致,方便记忆
点确认后,转移工作会在后台进行,可以点击上方的”文件操作记录“按钮,查看进度

冷存储数据转移到热存储的方法,和上面一致,反过来操作就好

# 如何从 anaconda/miniconda 迁移到 miniforge

由于anaconda对公司体量需要商业付费,故有使用anaconda/miniconda的,可迁移到开源免费平替 miniforge 上,基本完全平替,使用方式保持一致。
对于直接使用 pip 的同学可无需理会

可按以下步骤迁移到miniforge 上:

# 1. 先导出旧环境env

假如叫 my_env_torch,具体可用conda env list查看,把需要的都导出来

conda activate my_env_torch  # 先进入此环境
conda env export > /workspace/nas-data/my_env_torch.yaml

# 2. 删除 anaconda 或 miniconda

which conda   # 查看 conda 安装在哪个目录 
#  假如输出是 /root/miniconda3/bin/conda,则直接删除 /root/miniconda3
rm -rf /root/miniconda3

# 3. 安装 miniforge

详见官网:https://github.com/conda-forge/miniforge
Linux/MAC 用下面命令安装:

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh

安装过程中最后一个选项记得选 yes,不然需要自己配置 .bashrc,安装完后重开一下 terminal 生效
确认一下安装是否成功:

which conda
# 输出类似这样则成功了:/root/miniforge3/condabin/conda

# 4. 修改源

编辑~/.condarc,添加如下源信息(清华源):
vim ~/.condarc 写入:

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
  pytorch3d: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
  pytorch-test: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
  nvidia: https://mirrors.cernet.edu.cn/anaconda-extra/cloud/

# 5. 导入旧环境到 miniforge

conda env create -f /workspace/nas-data/my_env_torch.yaml

有多个则执行多次,替换为你的环境路径即可

# 6. 使用 miniforge

使用方式和anaconda/miniconda 基本没什么区别,按以前习惯用即可

conda activate my_env_torch
conda list
conda install numpy

# 如何下载Google Drive文件

假如获取到谷歌网盘的分享链接为: https://drive.google.com/drive/folders/1LCtCz35j8UwGvXA8nCLzaYNZPPwFaw-E
下载方式如下(注意需要外网加速才能下载,如果不知道 hai run加速,可参考前面的《通用外网下载加速器》章节):

cd xxxx  # 先进入到保存目录
pip3 install gdown
hai run gdown https://drive.google.com/drive/folders/1LCtCz35j8UwGvXA8nCLzaYNZPPwFaw-E --folder

# 如何下载HuggingFace单个文件/仓库

Contributed by Lu Liu

可支持单个文件下载、整个仓库下载
详细操作说明请见这里 (opens new window)