Skip to content

Conversation

helpmefindaname
Copy link
Member

@helpmefindaname helpmefindaname commented Jan 4, 2023

This PR does 2 little things:

  • it makes it easier to clean up the gpu memory, by cleaning gradients and deleting the reference of the optimzier. Hence torch.cuda.empty_cache() will be able to clean up more parameters.
  • some (slow) tokenizers like RobertaTokenizer seem to add a [SEP] token at the end, breaking the legacy subword token mapping, which is fixed by allowing that specific token

@helpmefindaname
Copy link
Member Author

With those changes, I managed to train XLM-Roberta-Large (>2GB model) with adam and full precision (4x the memory requirement) on my 6GB laptop graphic card, using transformer-smaller-training-vocab

@alanakbik alanakbik merged commit fa9b104 into master Jan 16, 2023
@alanakbik alanakbik deleted the release_optimizer_memory_and_fix_legacy_tokenization branch January 16, 2023 14:53
@alanakbik
Copy link
Collaborator

@helpmefindaname thanks for improving this!

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

Successfully merging this pull request may close these issues.

2 participants