Finetune on multi-GPUs
See original GitHub issueI want to finetune the models on multi-GPUs, as following the office documents, I try this:
model = make_model( args.model_name, pretrained=True, num_classes=len(classes), dropout_p=args.dropout_p, use_original_classifier=True )
model = nn.DataParallel(model)
model = model.to(device)
But get error as:
Traceback (most recent call last): File "pg_cls.py", line 83, in <module> mean=model.original_model_info.mean, File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __getattr__ type(self).__name__, name)) AttributeError: 'DataParallel' object has no attribute 'original_model_info'
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Wav2vec fine-tuning with multiGPU - Hugging Face Forums
I'm fine-tuning wav2vec model with Fine-Tune XLSR-Wav2Vec2 for low-resource ASR with Transformers at local machine with 4xT4 GPU (16Gb)
Read more >How to Fine-Tune YOLOv5 on Multiple GPUs
Simple screen finetuning. The simplest way to search for hyper-parameters is to run the training with an enabled evolution --evolve <number> argument. But ......
Read more >How to parallel in GPU when finetuning - PyTorch Forums
In my Finetune models , I wanna parallel my model, in multi-gpus, my code is shown below: class FinetuneModel(nn.Module): def __init__(self, ...
Read more >Multi-gpus — bio-transformers v0.1.14
Note that ray parallelization is only used for inference function. finetune method uses pytorch-lightning with its built-in function to train a model.
Read more >Niels Rogge on Twitter: "(m)LUKE by @StudioOusia is a ...
Accelerate, a great solution for folks that want to write their own training loop but have it run instantly on (multi) GPUs or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For now, you can use standard PyTorch methods to freeze some layers:
Create a new model:
To freeze all feature extracting layers and finetune only the classifer:
To freeze only some layers of the feature extractor:
You will also need to pass only parameters from ‘unfrozen’ layers to an optimizer or you will get an exception
I will think about how this functionality could be added to the library.
@creafz sorry for replying late, your answers help a lot, then I would close this issue now