baichuan-7B

版本

运行模型:baichuan-7B

torch==1.13.1
transformers==4.28.1
cuda: 11.4

另一个可跑的服务器的各个库版本:

torch==1.13.1
transformers==4.28.1
cuda: 11.7

只有cuda有点出入

Code

from transformers import AutoModelForCausalLM, AutoTokenizer

model_path = "../models/baichuan-7b/"

tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto", trust_remote_code=True)
inputs = tokenizer('你好!', return_tensors='pt')
outputs = model(**inputs)
print(outputs)

Log

  File "/root/miniconda3/lib/python3.11/site-packages/torch/nn/modules/linear.py", line 114, in forward
    return F.linear(input, self.weight, self.bias)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: CUDA error: CUBLAS_STATUS_NOT_INITIALIZED when calling `cublasCreate(handle)`
../aten/src/ATen/native/cuda/IndexKernel.cu:92: operator(): block: [0,0,0], thread: [32,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/IndexKernel.cu:92: operator(): block: [0,0,0], thread: [33,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/IndexKernel.cu:92: operator(): block: [0,0,0], thread: [34,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
../aten/src/ATen/native/cuda/IndexKernel.cu:92: operator(): block: [0,0,0], thread: [35,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.

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

这个错误查了一些解答

  1. batch size过大
    这个GPU的占用情况应该是够用的
  1. shape不对应
    这里的报错,input.shape和self.weight.shape应该是对应的
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 《中国说唱巅峰对决2023》第11期加更舞台。巅峰rapper暖心返场,惊喜合作碰出新鲜感! 功夫胖、依加带来《庇...
    娱娱鱼阅读 210评论 0 0
  • 成功是做有感觉的事,有感觉的做事。 人这辈子最大的悲哀就是找了一个没感觉的人做一件没感觉的事。 最高境界是找一个爱...
    S爱笑的眼睛阅读 63评论 0 1
  • 简单一句话,点醒梦中人 文/仁德上人 一句话点醒梦中人,除了你这听见看见的灵知就是佛道,还有什么呢?你还要追求什么...
    仁德上人阅读 78评论 0 0
  • 焦点日记分享第35天 学习焦点之后,拥有了一双发现美的眼睛,当拥有发现美的眼睛之后,其实身边的每一件事都是好事,每...
    幸福心理学阅读 47评论 0 0
  • 诗词撷英 律诗荟萃 芦花 邹纪军 苍苍荻浦已伤秋,夹岸飘蓬荡客愁。 夕照野滩飞鹭鸟,疏茎寒水钓蟾钩。 可怜一夜霜侵...
    诗图佳得阅读 97评论 0 1