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

大模型推理环境安装过程中踩坑记录

1.找不到libsndfile

  File "/.conda/envs/gemma/lib/python3.11/site-packages/soundfile.py", line 181, in <module>import _soundfile_data  # ImportError if this doesn't exist^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_soundfile_data'During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/.conda/envs/gemma/lib/python3.11/site-packages/soundfile.py", line 190, in <module>raise OSError('sndfile library not found using ctypes.util.find_library')
OSError: sndfile library not found using ctypes.util.find_libraryDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "gemma-app1.py", line 83, in predictinputs = processor.apply_chat_template(^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/.conda/envs/gemma/lib/python3.11/site-packages/transformers/utils/deprecation.py", line 172, in wrapped_funcreturn func(*args, **kwargs)^^^^^^^^^^^^^^^^^^^^^File "/.conda/envs/gemma/lib/python3.11/site-packages/transformers/processing_utils.py", line 1598, in apply_chat_templatebatch_audios.append(load_audio(fname, sampling_rate=mm_load_kwargs["sampling_rate"]))^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/.conda/envs/gemma/lib/python3.11/site-packages/transformers/audio_utils.py", line 62, in load_audioaudio = librosa.load(audio, sr=sampling_rate)[0]^^^^^^^^^^^^File "/.conda/envs/gemma/lib/python3.11/site-packages/lazy_loader/__init__.py", line 83, in __getattr__attr = getattr(submod, name)^^^^^^^^^^^^^^^^^^^^^File "/.conda/envs/gemma/lib/python3.11/site-packages/lazy_loader/__init__.py", line 82, in __getattr__submod = importlib.import_module(submod_path)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/.conda/envs/gemma/lib/python3.11/importlib/__init__.py", line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "<frozen importlib._bootstrap>", line 1204, in _gcd_importFile "<frozen importlib._bootstrap>", line 1176, in _find_and_loadFile "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlockedFile "<frozen importlib._bootstrap>", line 690, in _load_unlockedFile "<frozen importlib._bootstrap_external>", line 940, in exec_moduleFile "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removedFile "/.conda/envs/gemma/lib/python3.11/site-packages/librosa/core/audio.py", line 10, in <module>import soundfile as sfFile "/.conda/envs/gemma/lib/python3.11/site-packages/soundfile.py", line 212, in <module>_snd = _ffi.dlopen(_explicit_libname)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: cannot load library 'libsndfile.so': libsndfile.so: cannot open shared object file: No such file or directory
Error generating response: cannot load library 'libsndfile.so': libsndfile.so: cannot open shared object file: No such file or directory

解决方法:

conda install -c conda-forge libsndfile

2.Input type (torch.cuda.FloatTensor) and weight type (CUDABFloat16Type) should be the same

原始代码如下:

inputs = processor.apply_chat_template(messages,add_generation_prompt=True,tokenize=True,return_dict=True,return_tensors="pt",).to(device)

修改后:

inputs = processor.apply_chat_template(messages,add_generation_prompt=True,tokenize=True,return_dict=True,return_tensors="pt",).to(device, dtype=torch.bfloat16)

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

相关文章:

  • 野外具身视觉跟踪:北大团队TrackVLA让AI视觉跟踪进化到2.0时代
  • Springboot使用外部的Servelt容器(最简单的方式)
  • 1-bit AI 基础设施:第 1.1 部分 —— 在 CPU 上实现快速且无损的 BitNet b1.58 推理
  • ubuntu24.04安装CUDA、VLLM、Pytorch等并部署Qwen3-8B-AWQ【50系显卡通用】
  • proxmox 解决docker容器MongoDB创建报错MongoDB 5.0+ requires a CPU with AVX support
  • Leetcode力扣解题记录--第73题(矩阵置零)
  • Leetcode题解:209长度最小的子数组,掌握滑动窗口从此开始!!!
  • Vue中最简单的PDF引入方法及优缺点分析
  • Gradio, Streamlit, Dash:AI应用开发的效率之选
  • 配置https ssl证书生成
  • 拓展三字棋
  • ansible 批量 scp 和 load 镜像
  • 2025 年 7 月 21 日 AI 日报
  • 位运算符的妙用
  • 消息推送功能设计指南:精准触达与用户体验的平衡之道
  • OpenCV 零基础到项目实战 | DAY 1:图像基础与核心操作
  • Qt文件操作:读写文件的各种方法
  • 模运算常见定律
  • Java学习----Redis集群
  • Custom SRP - Draw Calls
  • Linux异常与信号处理
  • 11.【C语言学习笔记】指针(三)(回调函数、qsort排序函数、sizeof关键字和strlen函数)
  • Mixed Content错误:“mixed block“ 问题
  • 西门子 S7-1500分布式 I/O通信 :PROFINET IO 与 PROFIBUS DP核心技术详解(上)
  • 知识库搭建之Meilisearch‘s 搜索引擎-创建搜索引擎项目 测评-东方仙盟测评师
  • 【Godot4】状态栏组件StatusBar
  • python中 tqdm ,itertuples 是什么
  • RabbitMQ--批量处理
  • halcon手眼标定z方向实操矫正
  • VUE 中父级组件使用JSON.stringify 序列化子组件传递循环引用错误