Skip to content

CLI fails on startup: AttributeError: module 'torch' has no attribute 'uint64' via transformers/safetensors #40

@baliqbalpe

Description

@baliqbalpe

Description

  • Running fuzzyai -h crashes immediately during import. The crash originates from safetensors importing torch.uint64, which PyTorch does not provide. This looks like a dependency-compatibility problem introduced by newer safetensors (and transitively via transformers), not user code.
  • Suggest pinning safetensors < 0.5.0 or gating/lazy-importing local LLM providers so heavy deps aren’t imported unless used.

Environment

  • Install source: pip install git+https://github.com/cyberark/FuzzyAI.git (resolved to commit 2d1d4e6bfc5fbc3b5349f6387d1353f125809402)
  • Python: 3.10
  • Platform: Linux x86_64 wheels shown in pip logs
  • Key packages (from install log):
    • fuzzyai==1.0.0
    • torch==2.2.2
    • transformers==4.51.3
    • safetensors==0.6.1
    • sentence-transformers==2.7.0

Steps to reproduce

pip install --upgrade pip
pip install git+https://github.com/cyberark/FuzzyAI.git
fuzzyai -h

Expected behavior

  • CLI prints help text.

Actual behavior

  • Immediate crash with AttributeError: module 'torch' has no attribute 'uint64'.

Traceback (excerpt)

...
  File "/root/fuzzai-env/lib/python3.10/site-packages/transformers/pytorch_utils.py", line 21, in <module>
    from safetensors.torch import storage_ptr, storage_size
  File "/root/fuzzai-env/lib/python3.10/site-packages/safetensors/torch.py", line 439, in <module>
    torch.uint64: 8,
  File "/root/fuzzai-env/lib/python3.10/site-packages/torch/__init__.py", line 1938, in __getattr__
    raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
AttributeError: module 'torch' has no attribute 'uint64'
...
RuntimeError: Failed to import transformers.generation.utils because of the following error:
module 'torch' has no attribute 'uint64'

Workarounds tested

  • Downgrading safetensors resolves the crash:
pip uninstall -y safetensors
pip install "safetensors==0.4.3"
# then
fuzzyai -h  # works

Proposed fixes

  • Pin dependency in pyproject.toml/requirements:
    • safetensors>=0.4.3,<0.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions