Repository navigation
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@ggerganov This sadly does not seem to allow using more than recommendedMaxWorkingSetSize. Tested on M1 Max with 32GB RAM. I set the ctx size to 2700 to trigger the limit, 2600 was still below and worked fine. |
Thanks for your method. I met same problem " failed with status 5", and I change n_ctx from 4096 to 2000, then it works fine. my env : apple m2 pro 16gb |
|
What would be nice was if reducing --gpulayers fixed the problem, so that only the layers that Metal was actually running counted towards the recommendedMaxWorkingSetSize. I have an M2 MacBook Pro with 64GB, recommendedMaxWorkingSetSize = 49152.00 MB, so I can run LLama2 70B 6-bit quantized on CPU (rather slow), but not on GPU — I guess I'll need to redownload one of the 5-bit quantized versions, rather than just shifting a few layers to CPU threads. Also, it would be nice if hitting this situation gave a more comprehensible error message than:
without the end user having to first fritz with the code to get GGML Metal debug logging turned back on and then decypher the meaning of the rather opaque:
Perhaps something like "Current allocated size is greater than the recommended max working set size: Metal ran out of memory for running your model on GPU (try a smaller context length or smaller model)" |
|
According to https://developer.apple.com/documentation/metal/mtlcommandbufferstatus/error status 5 is a generic 'an error occurred during your command' status, and application code should be checking the error property for more details. So we should do that before emitting a diagnostic message like I suggested above. Also, from what I'm reading, recommendedMaxWorkingSetSize is an approximate, soft, recommended limit for an application to play nice with Metal, and the
messages that we're emitting are warnings, not errors, so I'm surprised we're getting a hard refusal for exceeding this. But when I checked the error details, I do seem to be getting a actual outOfMemory error code from Metal, so perhaps we kept going past the warnings until we hit an actual out-of-memory error. Anyway, I implemented code to check the error status and emit a diagnostic message if Metal's out of memory, see: I'm not familiar with Objective-C so it may be hacky, but the basic outline is there. This should probably be propagated back into llama.cpp, but I'm leaving that as an excise for someone else. |
Not sure if this helps
cc @CyborgArmy83 please give it a try and see if you can load more models with this patch