Install Python modules for the LoRa resizing script

The LoRa resizer batch script requires a series of modules to run, which must be installed separately. Check out this reference to install all the required modules.

To solve these errors, open a command prompt and run the shown commands.

ModuleNotFoundError: No module named ‘safetensors’

pip install safetensors

ModuleNotFoundError: No module named ‘toml’

pip install toml

ModuleNotFoundError: No module named ‘transformers’

pip install transformers

ModuleNotFoundError: No module named ‘diffusers’

pip install diffusers

ModuleNotFoundError: No module named ‘cv2’

pip install opencv-python

AssertionError: Torch not compiled with CUDA enabled

This requires an additional step to determine your CUDA version.

nvidia-smi command outputDetermine the correct version of PyTorch for your system:

  1. Identify your GPU’s CUDA version:
    • Run nvidia-smi to see the CUDA version supported by your driver.
  2. Check the PyTorch installation page to find the corresponding binary for that version.
  3. Use the provided pip command that matches your CUDA version.

For example:

  • Your GPU supports CUDA 12.4.
  • The PyTorch website offers binaries for CUDA 12.4.

Run this command to install PyTorch:

pip install torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cu124

This will solve all your LoRa resizer script errors. To use it, simply place the source LoRas in the big, med or small folders, depending in the desired output file compression ratio.

For reference, a 217 MB Inuyasha LoRa safetensors file was reduced to 68 MB in the small folder, and 82 MB in the med folder.

 

Disclaimer

The content in this post is for general information purposes only. The information is provided by the author and/or external sources and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose. Some of the content and images used in this post may be copyrighted by their respective owners. The use of such materials is intended to be for educational and informational purposes only, and is not intended to infringe on the copyrights of any individuals or entities. If you believe that any content or images used here violate your copyright, please contact us and we will take appropriate measures to remove or attribute the material in question.