Qingyao Hu
Qingyao Hu

Reputation: 11

Too many files open

import PIL as Image
Image.fromarray(cv2.imread(link, cv2.IMREAD_GRAYSCALE))

I'm currently trying to complete a project but I'm constantly getting too many files open error on my linux GPU server which crashes the server.

I'm loading 3 images for CNN classification using the code as shown above. Anyone facing the same problem have a solution to this?

Thank you.

Upvotes: 0

Views: 4848

Answers (1)

Silas Jojo
Silas Jojo

Reputation: 51

Try switching to the file strategy system by adding this to your script

import torch.multiprocessing
torch.multiprocessing.set_sharing_strategy('file_system')

Upvotes: 5

Related Questions