当前位置:   article > 正文

解决sd创建嵌入式模型报错TypeError: list indices must be integers or slices, not str_sd 总报错typeerror: list indices must be integers or

sd 总报错typeerror: list indices must be integers or slices, not nonetype 用

结论:把左上角sd大模型换成不带xl的版本,比如v1-5版本或v2-1版本。

背景:

突然也是心血来潮想自己训练个模型,跟着b站@Nenly大佬的一个视频先做个老黄的embeddings模型训练(那视频质量确实高,相信会有很多人看),结果到了创建嵌入式模型这一步死活报错。

错误代码如下:

  1. Traceback (most recent call last):
  2. File "D:\software\sd-webui-aki\sd-webui-aki-v4.4\python\lib\site-packages\gradio\routes.py", line 488, in run_predict
  3. output = await app.get_blocks().process_api(
  4. File "D:\software\sd-webui-aki\sd-webui-aki-v4.4\python\lib\site-packages\gradio\blocks.py", line 1431, in process_api
  5. result = await self.call_function(
  6. File "D:\software\sd-webui-aki\sd-webui-aki-v4.4\python\lib\site-packages\gradio\blocks.py", line 1103, in call_function
  7. prediction = await anyio.to_thread.run_sync(
  8. File "D:\software\sd-webui-aki\sd-webui-aki-v4.4\python\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
  9. return await get_asynclib().run_sync_in_worker_thread(
  10. File "D:\software\sd-webui-aki\sd-webui-aki-v4.4\python\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
  11. return await future
  12. File "D:\software\sd-webui-aki\sd-webui-aki-v4.4\python\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
  13. result = context.run(func, *args)
  14. File "D:\software\sd-webui-aki\sd-webui-aki-v4.4\python\lib\site-packages\gradio\utils.py", line 707, in wrapper
  15. response = f(*args, **kwargs)
  16. File "D:\software\sd-webui-aki\sd-webui-aki-v4.4\modules\textual_inversion\ui.py", line 10, in create_embedding
  17. filename = modules.textual_inversion.textual_inversion.create_embedding(name, nvpt, overwrite_old, init_text=initialization_text)
  18. File "D:\software\sd-webui-aki\sd-webui-aki-v4.4\modules\textual_inversion\textual_inversion.py", line 259, in create_embedding
  19. cond_model([""]) # will send cond model to GPU if lowvram/medvram is active
  20. File "D:\software\sd-webui-aki\sd-webui-aki-v4.4\python\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
  21. return forward_call(*args, **kwargs)
  22. File "D:\software\sd-webui-aki\sd-webui-aki-v4.4\repositories\generative-models\sgm\modules\encoders\modules.py", line 141, in forward
  23. emb_out = embedder(batch[embedder.input_key])
  24. TypeError: list indices must be integers or slices, not str

折腾了半天,很少有人提到这个问题,基本都是python编程圈的,这开源代码+秋葉大佬启动器我何德何能去改代码错误?

于是我尝试换版本,不行;关掉所有插件,不行;检查路径确保没有中文,不行。偶尔在一些地方碰到有提到此问题的,也是无解不了了之,整得好像大多数人都没遇到这个错误,可我啥都没设置啊!真够绝望的

最后终于终于终于在wai网里找到了一个解决方法:[Bug]: Exception when trying to create an embedding on Train tab · Issue #12344 · AUTOMATIC1111/stable-diffusion-webui · GitHub

具体内容看不太懂,但隐约从字眼里行间看到说选xl模型不太行。本来我是想不到创建个空嵌入式模型和大模型有啥关系,因为明明还没开始训练,就没往这方面想过。结果换完发现真的好了!!

第一次发文章,感觉csdn点赞经常少的一批(虽然我也不知道多了有啥用),如果有帮到不妨点个赞!!!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/642869
推荐阅读
相关标签
  

闽ICP备14008679号