How to improve GPU memory usage of SpanCat #12521
-
Hey everyone. I'm coding a SpanCat model using a large corpus (the train Spacy data has ~100mb) and, for some reason, I'm not being able to launch the training on my GPU. I'm using a VM hosted on GCP. The VM has an A100 with 40GB of RAM. As soon as the train starts (after the header of the report appears, but before any line is displayed) I get a memory error like the following:
I've already tried to change some hyperparameters, trying to fit the data into the RAM memory, but I wasn't able to do so. And it doesn't really much sense, because I'm using essentially the same data to train a NER model (I've just changed the Spacy file creation, of course) and for the NER model I was able to train the whole model with my machine GPU which is a 3070 with 8GB of RAM Any ideas of what should I do? There is any hyperparamter I can change? This is my current config:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi! Sorry to hear you're running into this annoying memory issue. It's interesting that you say that you were able to train an NER model on the same data without issues. Have you tried running this with setting Also, did you run
which means it will predict every single 1-gram, 2-gram or 3-gram, which are a lot of candidate entities. If you can prune this somehow, that would help. Just FYI, we also have a few experimental approaches you could look into: https://github.com/explosion/spacy-experimental/tree/master/spacy_experimental/span_suggesters & https://github.com/explosion/spacy-experimental/tree/master/spacy_experimental/span_finder. Have a look at https://explosion.ai/blog/spancat for more details around this. Let me know what you find! 🤞 |
Beta Was this translation helpful? Give feedback.
Hey! So do I understand it correctly that this has been resolved in #12551 (reply in thread) ?