Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issue on -> Cannot close object, library is destroyed. This may cause a memory leak! #222

Open
MichaelOcampo1104 opened this issue May 15, 2024 · 9 comments

Comments

@MichaelOcampo1104
Copy link

working fine previously however recently, Im getting no ouputs with message -> Cannot close object, library is destroyed. This may cause a memory leak!, im using a colab notebook

@Crestina2001
Copy link

Have you solved this yet?

@isayahc
Copy link

isayahc commented May 24, 2024

do you use nougat or predict.py?

I found a hacky way of solving it by adding del model_kwargs['cache_position'] into venv/lib/python3.12/site-packages/transformers/generation/utils.py after line 2390 which should be model_kwargs = self._get_initial_cache_position(input_ids, model_kwargs) then using predict.py such as predict.py sample_pdf -o output/

Additional Information

python version Python 3.12.2

transformers==4.41.1
pytorch-lightning==2.2.5
torch==2.3.0
torchmetrics==1.4.0.post0
torchvision==0.18.0

@ELchem
Copy link

ELchem commented May 25, 2024

this is an issue with pypdfium2.PdfDocument not being closed

@shadi007
Copy link

i am using nougat in colab and it gives this error "Cannot close object, library is destroyed. This may cause a memory leak!" is there a way of solving or to use nougat but using predict.py i have no experience with coding

@shadi007
Copy link

do you use nougat or predict.py?

I found a hacky way of solving it by adding del model_kwargs['cache_position'] into venv/lib/python3.12/site-packages/transformers/generation/utils.py then using predict.py

Additional Information

python version Python 3.12.2

transformers==4.41.1 pytorch-lightning==2.2.5 torch==2.3.0 torchmetrics==1.4.0.post0 torchvision==0.18.0

could you please explain in details how you use predict.py

@shadi007
Copy link

shadi007 commented Jun 2, 2024

Have you solved this yet?

did u find a solution to this problem

@augustoximenes
Copy link

augustoximenes commented Jun 3, 2024

Try:

pip install transformers==4.38.2

@isayahc
Copy link

isayahc commented Jun 3, 2024

do you use nougat or predict.py?
I found a hacky way of solving it by adding del model_kwargs['cache_position'] into venv/lib/python3.12/site-packages/transformers/generation/utils.py then using predict.py

Additional Information

python version Python 3.12.2
transformers==4.41.1 pytorch-lightning==2.2.5 torch==2.3.0 torchmetrics==1.4.0.post0 torchvision==0.18.0

could you please explain in details how you use predict.py
@shadi007
Here is a sample cli command i use
predict.py sample_pdf -o output/

Also i will add more information in my first reponse.

@ludwigax
Copy link

ludwigax commented Jun 4, 2024

This is a problem using the Transformer with versions later than 4.38.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants