Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

关于L1 G4000文档的修改小建议

未关闭
#2,264 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
停滞
技术栈
python, pytorch
领域
documentation

调研方向

在 InternLM/Tutorial 仓库中,查找 L1 G4000 教程以及列出的 conda 和 pip 命令。检查依赖项安装顺序和 torch/CUDA 验证代码片段。文档中的操作顺序保留 PyTorch 2.0.1 和 CUDA 11.7,并说明如何在模型推理前进行验证,即视为完成。

由索引模型根据 Issue 内容生成。

描述

关于这个教程文档,我有些修改的小建议。

文档中的配置环境的顺序是这样的:

# 1. 创建并激活环境
conda create -n llamaindex python=3.10
conda activate llamaindex

# 2. 首先安装特定版本的 PyTorch,并确保使用 CUDA 11.7
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.7 -c pytorch -c nvidia

# 3. 安装基础依赖
pip install einops==0.7.0 protobuf==5.26.1

# 4. 安装 LLamaIndex 相关
pip install llama-index==0.10.38 
pip install llama-index-llms-huggingface==0.2.0
pip install "transformers[torch]==4.41.1"
pip install "huggingface_hub[inference]==0.23.1" huggingface_hub==0.23.1
pip install sentence-transformers==2.7.0 
pip install sentencepiece==0.2.0

# 5. 安装向量依赖包
pip install llama-index-embeddings-huggingface==0.2.0 
pip install llama-index-embeddings-instructor==0.1.3

存在的问题是:匹配cuda11.7的torch安装在前,但是其后安装 LLamaIndex 相关的指令会稳定触发torch的升级到最新版本,而新版本的PyTorch (2.5.1) 默认使用CUDA 12.4

pip install llama-index==0.10.38 llama-index-llms-huggingface==0.2.0 "transformers[torch]==4.41.1" "huggingface_hub[inference]==0.23.1" huggingface_hub==0.23.1 sentence-transformers==2.7.0 sentencepiece==0.2.0

pip install llama-index-embeddings-huggingface==0.2.0 llama-index-embeddings-instructor==0.1.3

这样,当进行到模型推理的步骤时,就会有

RuntimeError: CUDA error: CUBLAS_STATUS_NOT_INITIALIZED when calling cublasCreate(handle)

报错,也就是说安装教程的顺序走,稳定会在模型推理的的时候遇到cuda报错(虽然文档有一行对应的提示)

必须再次重新安装正确的torch:

conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.7 -c pytorch -c nvidia

文档里关于环境配置的内容也许可以这样修改:

# 1. 创建并激活环境
conda create -n llamaindex python=3.10
conda activate llamaindex

# 2. 安装基础依赖
pip install einops==0.7.0 protobuf==5.26.1

# 3. 先安装 LlamaIndex 和相关包,让它自动处理依赖关系
# 注意:此时 pip 会安装与你当前环境不同的 torch 版本。
pip install llama-index==0.10.38 llama-index-llms-huggingface==0.2.0 "transformers[torch]==4.41.1" "huggingface_hub[inference]==0.23.1" huggingface_hub==0.23.1 sentence-transformers==2.7.0 sentencepiece==0.2.0

# 4. 安装向量依赖包
pip install llama-index-embeddings-huggingface==0.2.0 llama-index-embeddings-instructor==0.1.3

# 5. 强制重装特定版本的 PyTorch (这会覆盖/降级之前自动安装的版本)
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.7 -c pytorch -c nvidia

安装完成后,验证 torch 是否正确安装并使用了指定的 CUDA 版本:

import torch
print(torch.__version__)        # 应输出类似 '2.0.1'
print(torch.version.cuda)       # 应输出 '11.7'
print(torch.cuda.is_available())# 应输出 True
主要语言
Python
星标
2k
派生
1.5k
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

InternLM/Tutorial 的其他 Issue

查看 InternLM/Tutorial 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。