I wonder how much memory can Python hold until an error like “out of memory” happens, because ML models (for example, those hosted and served in HuggingFace) loads training weights with dozens of GBs
All the stuff that’s LLM and the actual “serious” python libraries are implemented in C/C++ and only made accessible via python.
Which doesn’t directly answer the question of what the maximum is, in those cases, but it should be obvious that C/C++ have some good ways to deal with memory.
You can still do “traditional” memory management in python, or “memory aware programming” like, e.g. not trying to read a file in one piece, but reading and processing line by line.
All the stuff that’s LLM and the actual “serious” python libraries are implemented in C/C++ and only made accessible via python.
Which doesn’t directly answer the question of what the maximum is, in those cases, but it should be obvious that C/C++ have some good ways to deal with memory.
You can still do “traditional” memory management in python, or “memory aware programming” like, e.g. not trying to read a file in one piece, but reading and processing line by line.
And using C from python is actually very easy and convenient with ctypes. https://docs.python.org/3/library/ctypes.html