LayoutLMv2 model not supporting training on more than 1 GPU when using PyTorch Data Parallel #14110
Comments
|
Hi, I've answered this question here. TDLR: you need to first call |
|
Hi @NielsRogge Thanks for your quick response. I looked at that repo as well just a couple of minutes back. The problem that I face using that solution is it gives this error: I read the above-linked post. The OP there also faces the same problem and you recommend the following: Using this in the code forces me to implement DistributedDataParallel instead of the conventional DataParallel. Can you suggest something to help further? It requires setting up the backend, rank, and world_size for DistributedDataParallel. Is this the way to go? Can you give an example of a running script that handles batch synchronization without forcing with DataParallel? Currently, I have added the following lines of code in my script: The terminal hangs and there is no output displayed. Any help on this case will be highly appreciated!! Thanks once again! |
|
Are you running all of this in a notebook or as a script? The authors defined everything in a Python script, which they then launch as follows: That's the recommended way to train deep learning models with PyTorch on multiple GPUs. It would be great if we can add an example script for LayoutLMv2/LayoutXLM to the examples folder of HuggingFace Transformers. It would mean updating the Python script for it to work with HuggingFace Transformers instead of the original unilm repository. Are you interested in contributing this? |
|
Actually, let me mark it as a "good first issue" (this is a good first contribution for people interested in contributing). This way, we can help others fine-tune LayoutLMv2 on multiple GPUs. |
Environment info
transformersversion: 4.11.2Who can help
Models: LayoutLMv2 @NielsRogge
Information
Model I am using: LayoutLMv2
The problem arises when using:
The tasks I am working on is:
To reproduce
Steps to reproduce the behavior:
##Error
The text was updated successfully, but these errors were encountered: