🧨 Describe the Bug
ImportError: cannot import name 'find_pruneable_heads_and_indices' from 'transformers.pytorch_utils'
The same polyfill fix as filliptm/ComfyUI_FL-SongGen@5c495e6#diff-f43a6d486eac90b16750cb315a032cfe56c936f1dd409b063d70bda04e26c70e fixed this for me
📄 Input Document
N/A
📤 Output Trace / Stack Trace
Paste the complete stack trace or error output, if available.
Click to expand
# surya_table ./example.pdf
Traceback (most recent call last):
File "./venv/bin/surya_table", line 5, in <module>
from surya.scripts.table_recognition import table_recognition_cli
File "./venv/lib/python3.12/site-packages/surya/scripts/table_recognition.py", line 11, in <module>
from surya.table_rec import TableRecPredictor
File "./venv/lib/python3.12/site-packages/surya/table_rec/__init__.py", line 15, in <module>
from surya.table_rec.loader import TableRecModelLoader
File "./venv/lib/python3.12/site-packages/surya/table_rec/loader.py", line 13, in <module>
from surya.table_rec.model.encoderdecoder import TableRecEncoderDecoderModel
File "./venv/lib/python3.12/site-packages/surya/table_rec/model/encoderdecoder.py", line 10, in <module>
from surya.table_rec.model.encoder import DonutSwinModel
File "./venv/lib/python3.12/site-packages/surya/table_rec/model/encoder.py", line 6, in <module>
from surya.common.donut.encoder import DonutSwinPreTrainedModel, DonutSwinModelOutput, DonutSwinEmbeddings, DonutSwinEncoder
File "./venv/lib/python3.12/site-packages/surya/common/donut/encoder.py", line 11, in <module>
from transformers.pytorch_utils import (
ImportError: cannot import name 'find_pruneable_heads_and_indices' from 'transformers.pytorch_utils' (./venv/lib/python3.12/site-packages/transformers/pytorch_utils.py)
⚙️ Environment
Please fill in all relevant details:
- Surya version: 0.17.1
- Python version: 3.12
- PyTorch version: 2.10.0
- Transformers version: 5.2.0
- Operating System (incl. container info if relevant): WSL 2 + Ubuntu 24.04
✅ Expected Behavior
What did you expect surya_table to do?
Extract tables from my PDF and not crash.
📟 Command or Code Used
Paste the exact bash command or Python code you used to run surya_table:
Click to expand
surya_table ./example.pdf
📎 Additional Context
Any other context that might help us debug this (e.g., CLI options, working directory, runtime settings).
🧨 Describe the Bug
ImportError: cannot import name 'find_pruneable_heads_and_indices' from 'transformers.pytorch_utils'
The same polyfill fix as filliptm/ComfyUI_FL-SongGen@5c495e6#diff-f43a6d486eac90b16750cb315a032cfe56c936f1dd409b063d70bda04e26c70e fixed this for me
📄 Input Document
N/A
📤 Output Trace / Stack Trace
Paste the complete stack trace or error output, if available.
Click to expand
⚙️ Environment
Please fill in all relevant details:
✅ Expected Behavior
What did you expect
surya_tableto do?Extract tables from my PDF and not crash.
📟 Command or Code Used
Paste the exact bash command or Python code you used to run
surya_table:Click to expand
📎 Additional Context
Any other context that might help us debug this (e.g., CLI options, working directory, runtime settings).