ZHO-ZHO-ZHO / ComfyUI-Phi-3-mini

Using Phi-3-mini in ComfyUI
GNU General Public License v3.0
188 stars 15 forks source link

TypeError: can only concatenate str (not "dict") to str #8

Open 108863258 opened 4 months ago

108863258 commented 4 months ago

TypeError: can only concatenate str (not "dict") to str

kupeau commented 4 months ago

TypeError: can only concatenate str (not "dict") to str

Hi,

Most likely it is happening because of the incompatible transformers version. microsoft/Phi-3-mini-4k-instruct requires transformers 4.41.0.dev0 version. Please check yours using the pip list | grep transformers or on windows: pip show transformerscommands in the ComfyUI python environment. If it is not 4.41.0.dev0, it will not work.

The normal uninstall old / reinstall new version did not work for me. Every time I started ComfyUI, it removed the new and re-installed the old version**, one of the nodes always forced reinstalling the old transformers version.

I could solve this issue by performing the following steps:

  1. Disable ALL ComfyUI nodes, except ComfyUI Manager
  2. Restart ComfyUI
  3. Update ComfyUI
  4. Update ComfyUI Manager
  5. Shut down ComfyUI
  6. Activate the ComfyUI python environment
  7. Upgrade pip to the latest: pip install --upgrade pip or on Windowspy -m pip install --upgrade pip
  8. pip uninstall -y transformers
  9. pip uninstall -y image-reward (there was dependency conflict)
  10. pip install git+https://github.com/huggingface/transformers
  11. Start ComfyUI
  12. Enable [Phi-3-mini in ComfyUI] node
  13. Test if it works, if yes, you can reactivate and update other notes, one-by one

Reference: https://huggingface.co/microsoft/Phi-3-mini-4k-instruct#how-to-use

Cheers, kupe