libffcv / ffcv

FFCV: Fast Forward Computer Vision (and other ML workloads!)
https://ffcv.io
Apache License 2.0
2.83k stars 178 forks source link

Fix opposite os_cache behavior when creating Loader #74

Closed elicassion closed 2 years ago

elicassion commented 2 years ago

This small patch fixes the issue that os_cache behaves oppositely compared to declared in the document (https://docs.ffcv.io/parameter_tuning.html#scenario-large-scale-datasets). According to the document, when os_cache=True, FFCV will cache the whole dataset in RAM, thus ProcessCacheManager() should be used, which creates an np array in the memory. When os_cache=False, OSCacheManager() should be used, which uses np.memmap().

The current version is loading the whole dataset to RAM when os_cache=False.

GuillaumeLeclerc commented 2 years ago

Hello,

Sorry the documentation was confusing.

We would love a pull request on the documentation if you have a way to make it more clear to the readers.

elicassion commented 2 years ago

Hi Guillaume,

Thanks for the nice clarification! Order options will also affect RAM usage. I will try to improve the document.