jingyaogong / minimind-v

「大模型」3小时从0训练27M参数的视觉多模态VLM,个人显卡即可推理训练!
https://jingyaogong.github.io/minimind-v
Apache License 2.0
386 stars 42 forks source link

关于运行时报错 Transformer.generate() got an unexpected keyword argument 'image_encoders' #11

Open cmgyqjj opened 1 month ago

cmgyqjj commented 1 month ago

环境如下

autodl 4090
PyTorch  2.1.2
Python  3.10(ubuntu22.04)
Cuda  11.8

详细报错

Traceback (most recent call last):
  File "/root/miniconda3/lib/python3.10/site-packages/gradio/queueing.py", line 622, in process_events
    response = await route_utils.call_process_api(
  File "/root/miniconda3/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
    output = await app.get_blocks().process_api(
  File "/root/miniconda3/lib/python3.10/site-packages/gradio/blocks.py", line 2005, in process_api
    result = await self.call_function(
  File "/root/miniconda3/lib/python3.10/site-packages/gradio/blocks.py", line 1570, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/root/miniconda3/lib/python3.10/site-packages/gradio/utils.py", line 684, in async_iteration
    return await anext(iterator)
  File "/root/miniconda3/lib/python3.10/site-packages/gradio/utils.py", line 678, in __anext__
    return await anyio.to_thread.run_sync(
  File "/root/miniconda3/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/root/miniconda3/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
  File "/root/miniconda3/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    result = context.run(func, *args)
  File "/root/miniconda3/lib/python3.10/site-packages/gradio/utils.py", line 661, in run_sync_iterator_async
    return next(iterator)
  File "/root/miniconda3/lib/python3.10/site-packages/gradio/utils.py", line 822, in gen_wrapper
    response = next(iterator)
  File "/root/qjj/minimind-v/web_server.py", line 168, in chat_with_vlm
    for res in res_generator:
  File "/root/qjj/minimind-v/web_server.py", line 84, in chat
    y = next(res_y)
  File "/root/miniconda3/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 26, in generator_context
    gen = func(*args, **kwargs)
TypeError: Transformer.generate() got an unexpected keyword argument 'image_encoders'

请问大佬这可能是因为python3.10导致的原因吗?

cmgyqjj commented 1 month ago

在尝试使用 python 3.8版本之后,报错如下:

Traceback (most recent call last): File "/root/miniconda3/lib/python3.8/site-packages/gradio/queueing.py", line 536, in process_events response = await route_utils.call_process_api( File "/root/miniconda3/lib/python3.8/site-packages/gradio/route_utils.py", line 322, in call_process_api output = await app.get_blocks().process_api( File "/root/miniconda3/lib/python3.8/site-packages/gradio/blocks.py", line 1935, in process_api result = await self.call_function( File "/root/miniconda3/lib/python3.8/site-packages/gradio/blocks.py", line 1532, in call_function prediction = await utils.async_iteration(iterator) File "/root/miniconda3/lib/python3.8/site-packages/gradio/utils.py", line 671, in async_iteration return await iterator.anext() File "/root/miniconda3/lib/python3.8/site-packages/gradio/utils.py", line 664, in anext return await anyio.to_thread.run_sync( File "/root/miniconda3/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/root/miniconda3/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "/root/miniconda3/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, args) File "/root/miniconda3/lib/python3.8/site-packages/gradio/utils.py", line 647, in run_sync_iterator_async return next(iterator) File "/root/miniconda3/lib/python3.8/site-packages/gradio/utils.py", line 809, in gen_wrapper response = next(iterator) File "web_server.py", line 168, in chat_with_vlm for res in res_generator: File "web_server.py", line 84, in chat y = next(res_y) File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 26, in generator_context gen = func(args, **kwargs) TypeError: generate() got an unexpected keyword argument 'image_encoders'

jingyaogong commented 1 month ago

3-eval_chat正不正常 另外这个不是python版本的问题

cmgyqjj commented 1 month ago

3-eval_chat正不正常 另外这个不是python版本的问题

很高兴收到您的回复,这是只是执行了python web_server.py并且上传图片后进行聊天测试,并没有进行预训练。关于3-eval_chat正不正常的问题,我现在下一下已经训练权重测试下。

cmgyqjj commented 1 month ago

3-eval_chat正不正常 另外这个不是python版本的问题

经过我的测试,3-eval_chat是正常的