# Using Data Collator For Completion Only LM requires more memory

**URL:** <https://discuss.huggingface.co/t/using-data-collator-for-completion-only-lm-requires-more-memory/96172>\
**Category:** Beginners\
**Created:** [July 8, 2024, 1:54pm UTC](https://discuss.huggingface.co/t/using-data-collator-for-completion-only-lm-requires-more-memory/96172 "2024-07-08T13:54:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NofarSachs](https://avatars.discourse-cdn.com/v4/letter/n/b782af/32.png) [@NofarSachs](https://discuss.huggingface.co/u/NofarSachs)\
**Post date:** [July 8, 2024, 1:54pm UTC](https://discuss.huggingface.co/t/using-data-collator-for-completion-only-lm-requires-more-memory/96172/1 "2024-07-08T13:54:10Z")

</div>

Hello,  
I’m trying to use PHILSCHMID blog: [Efficiently fine-tune Llama 3 with PyTorch FSDP and Q-Lora](https://www.philschmid.de/fsdp-qlora-llama3)  
to fine-tune llama3 8b for completions only, ignoring prompts.  
I’m using trl’s DataCollatorForCompletionOnlyLM, as explained here: [Supervised Fine-tuning Trainer](https://huggingface.co/docs/trl/sft_trainer#advanced-usage)

For some reason, I get Cuda out-of-memory errors with a much smaller batch size than when I used the same script without the data collator.

Does it have to do with the packing=False argument passed to the trainer? because it seems like the training is much more memory-consuming.

Thank you for the clarification,  
Nofar
