Skip to content

Perf: enable pin_memory in DataLoader for CLM no_trainer example - #43056

Closed
RinZ27 wants to merge 1 commit into
huggingface:mainfrom
RinZ27:perf/pin-memory-v2
Closed

RinZ27 wants to merge 1 commit into
huggingface:mainfrom
RinZ27:perf/pin-memory-v2

Conversation

@RinZ27

@RinZ27 RinZ27 commented Dec 27, 2025

Copy link
Copy Markdown

This PR enables pin_memory=True in the DataLoader for the causal language modeling standalone example.

Pinned memory is a PyTorch best practice that improves host-to-device transfer efficiency.

@ArthurZucker

Copy link
Copy Markdown
Collaborator

thanks! tho we don't really maintain these anymore! @merveenoyan do you want to merge?

@RinZ27
RinZ27 force-pushed the perf/pin-memory-v2 branch 2 times, most recently from cc523c8 to c3de0e0 Compare January 10, 2026 09:59
@RinZ27

RinZ27 commented Jan 10, 2026

Copy link
Copy Markdown
Author

Hi @ArthurZucker, thanks for the response. @merveenoyan, just checking in to see if you have any thoughts on merging this. It's a small change but would be beneficial for anyone still using these examples for reference. Thanks!

@RinZ27
RinZ27 force-pushed the perf/pin-memory-v2 branch 6 times, most recently from 8bdb659 to c272c99 Compare January 15, 2026 06:48
@RinZ27
RinZ27 force-pushed the perf/pin-memory-v2 branch from c272c99 to 07bb743 Compare January 20, 2026 15:34
@RinZ27
RinZ27 force-pushed the perf/pin-memory-v2 branch from 07bb743 to 4732151 Compare January 20, 2026 15:43
@RinZ27

RinZ27 commented Jan 20, 2026

Copy link
Copy Markdown
Author

I've squashed the commits into a single clean one and ensured the pin_memory configuration properly checks for CUDA availability. The implementation is now streamlined and ready. @merveenoyan, would you mind taking a look for a final review when you have a moment? Thanks!

@ArthurZucker

Copy link
Copy Markdown
Collaborator

We removed the examples/pytorch scripts from the repository in #49357, so this change no longer applies. Thanks!

@RinZ27
RinZ27 deleted the perf/pin-memory-v2 branch October 22, 2026 09:05
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