Skip to content

Runtime crash on start.bat due to incompatible torch version (missing _attention_scale) #362

@zeshanabdullah10

Description

@zeshanabdullah10

Runtime crash on start.bat after installing Python via uv (torch / optimum incompatibility)

Summary

On Windows, following the official install flow (including installing Python via uv when prompted), install.bat completes successfully. However, running start.bat fails at runtime with an ImportError related to torch.onnx.symbolic_opset14._attention_scale.

This appears to be caused by an incompatible torch version being installed by uv, due to torch not being version-pinned.


Environment

  • OS: Windows 10 / 11

  • FastSD CPU version: 1.0.0-beta.281

  • Install method:

    • Ran install.bat

    • Python was missing, so followed the installer prompt

    • Installed Python using uv’s official instructions:

      powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
      

      (from https://docs.astral.sh/uv/getting-started/installation/)

    • Re-ran install.bat → completed successfully

  • Python: installed via uv

  • Torch installed by uv: 2.10.0+cpu


Steps to reproduce

  1. On a clean Windows system without Python:
  2. Run install.bat
  3. When prompted, install Python using uv’s official installer (link provided by the script)
  4. Re-run install.bat (completes successfully)
  5. Run start.bat

Actual behavior

Application crashes immediately at startup with:

ImportError: cannot import name '_attention_scale'
from 'torch.onnx.symbolic_opset14'

Traceback goes through:

optimum.exporters.onnx.model_patcher
→ torch.onnx.symbolic_opset14

Expected behavior

After following the installer’s guidance and a successful install, start.bat should launch the application.


Investigation / Findings

  • torch is importable and reports version:

    python -c "import torch; print(torch.__version__)"
    2.10.0+cpu
    
  • pip uninstall torch does not work because torch was installed by uv, not pip

  • optimum.exporters.onnx imports _attention_scale, which no longer exists in newer torch versions

  • This causes a runtime import failure, not an installation failure

Verified:

python -c "import torch.onnx.symbolic_opset14 as s; print(hasattr(s, '_attention_scale'))"
# False

Root cause

  • install.bat relies on uv for dependency installation
  • torch is not pinned in requirements.txt
  • uv installs the latest available torch (2.10.0+cpu)
  • That torch version is incompatible with Optimum’s ONNX exporter

Workaround

Manually pin torch to a compatible version, delete env, and re-run install:

torch<2.2

(or explicitly)

torch==2.1.2

After this, start.bat runs correctly.


Suggested fix

  • Pin torch to a compatible version in requirements.txt
  • Or document tested torch versions in the README

This would prevent a successful install followed by an immediate runtime crash.


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions