PeterH0323 / Streamer-Sales

Streamer-Sales 销冠 —— 卖货主播 LLM 大模型🛒🎁,一个能够根据给定的商品特点从激发用户购买意愿角度出发进行商品解说的卖货主播大模型。🚀⭐内含详细的数据生成流程❗ 📦另外还集成了 LMDeploy 加速推理🚀、RAG检索增强生成 📚、TTS文字转语音🔊、数字人生成 🦸、 Agent 使用网络查询实时信息🌐、ASR 语音转文字🎙️
https://openxlab.org.cn/apps/detail/HinGwenWong/Streamer-Sales
Apache License 2.0
1.8k stars 246 forks source link

启动web app问题 #3

Closed gotothehill closed 2 weeks ago

gotothehill commented 2 weeks ago

我启动web app的时候报错:

2024-06-27 15:25:16.467 Uncaught app exception Traceback (most recent call last): File "/root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/torch/serialization.py", line 531, in _check_seekable f.seek(f.tell()) AttributeError: 'NoneType' object has no attribute 'seek'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script exec(code, module.dict) File "/AI/Streamer-Sales/app.py", line 29, in from utils.model_loader import RAG_RETRIEVER File "/AI/Streamer-Sales/utils/model_loader.py", line 18, in TTS_HANDLER = get_tts_model() File "/root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 165, in wrapper return cached_func(*args, *kwargs) File "/root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 194, in call return self._get_or_create_cached_value(args, kwargs) File "/root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 221, in _get_or_create_cached_value return self._handle_cache_miss(cache, value_key, func_args, func_kwargs) File "/root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 277, in _handle_cache_miss computed_value = self._info.func(func_args, **func_kwargs) File "/AI/Streamer-Sales/utils/tts/gpt_sovits/inference_gpt_sovits.py", line 503, in get_tts_model max_sec, t2s_model = change_gpt_weights(gpt_path, is_half) File "/AI/Streamer-Sales/utils/tts/gpt_sovits/inference_gpt_sovits.py", line 93, in change_gpt_weights dict_s1 = torch.load(gpt_path, map_location="cpu") File "/root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/torch/serialization.py", line 986, in load with _open_file_like(f, 'rb') as opened_file: File "/root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/torch/serialization.py", line 440, in _open_file_like return _open_buffer_reader(name_or_buffer) File "/root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/torch/serialization.py", line 425, in init _check_seekable(buffer) File "/root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/torch/serialization.py", line 534, in _check_seekable raise_err_msg(["seek", "tell"], e) File "/root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/torch/serialization.py", line 527, in raise_err_msg raise type(e)(msg) AttributeError: 'NoneType' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load from it instead. /root/miniconda3/envs/streamer-sales/lib/python3.10/site-packages/streamlit/watcher/local_sources_watcher.py:196: UserWarning: Torchaudio's I/O functions now support par-call bakcend dispatch. Importing backend implementation directly is no longer guaranteed to work. Please use backend keyword with load/save/info function, instead of calling the udnerlying implementation directly. lambda m: [p for p in m.path._path],

请问,这个是什么问题呢?

PeterH0323 commented 2 weeks ago

你好,需要确认下几个事情:

1、环境是否和我一致 2、请描述下您的启动步骤

gotothehill commented 2 weeks ago

你好,需要确认下几个事情:

1、环境是否和我一致 2、请描述下您的启动步骤

我是按照你的详细步骤来的

  1. 环境搭建
  2. 微调数据集准备:我直接使用的你提供的 train.jsonl,没有自己去微调
  3. 训练:我下载的 internlm2-chat-7b-4bit模型训练的,使用的数据集为上面的train.jsonl,最终训练为 iter_2640.pth
  4. 说明书生成:这步我跳过了
  5. RAG 向量数据库:跳过了
  6. 部署:我只是将命令中的 iter_340 都改为了我这边训练后的 iter_2640。4bit量化也做了,测试速度报错:需要给7b模型命名。最后启动,然后报错了。
PeterH0323 commented 2 weeks ago

一般是使用 fp32 的模型作为预训练模型,训练好的模型再去量化 4bit ,您可以先使用我的模型,进行部署试下

gotothehill commented 2 weeks ago

一般是使用 fp32 的模型作为预训练模型,训练好的模型再去量化 4bit ,您可以先使用我的模型,进行部署试下

了解,也就是说训练时候,不能用4bit去训练是吧? 直接使用你的模型,是把你的模型下载下来放到文件夹:/work_dirs/internlm2_chat_7b_qlora_custom_data/ 就可以直接使用吗?还是要其他配置

PeterH0323 commented 2 weeks ago

对的,一般不建议用 4bit 去训练

不需要手动下载,直接启动就行,会自动下载的

gotothehill commented 2 weeks ago

对的,一般不建议用 4bit 去训练

不需要手动下载,直接启动就行,会自动下载的

我把云服务器重置,直接按照 快速体验 来启动,如下: git clone https://github.com/PeterH0323/Streamer-Sales.git cd Streamer-Sales conda env create -f environment.yml conda activate streamer-sales pip install -r requirements.txt

export USING_4BIT=true # 设置使用 4bit 模型 export KV_CACHE=0.05

streamlit run app.py --server.address=0.0.0.0 --server.port 7860

服务器用的A10 24G显卡,显卡驱动及cuda都已安装。还是报这个错误:AttributeError: 'NoneType' object has no attribute 'seek' ...

PeterH0323 commented 2 weeks ago

服务启动的时候有自动下载权重吗?估计是网络问题导致下载出错,模型权重没加载成功

gotothehill commented 2 weeks ago

服务启动的时候有自动下载权重吗?估计是网络问题导致下载出错,模型权重没加载成功

问题找到了,系统没有安装unzip,导致每次启动都下载一个zip文件,然后又解压不了,就启动失败了。

谢谢

PeterH0323 commented 2 weeks ago

谢谢反馈