In case it helps, from the memory allocation error you posted it looks like the error is triggered by pm.find_MAP, not by pm.sample nor by the conversion to InferenceData at the end of pm.sample. Does this error only happen when using return_inferencedata=True in pm.sample but leaving everything else as is? (there is little more we can do without a snippet that reproduces the error than some guesses and ask extra questions)
It also looks like you are sampling 10000 draws but also using target_accept which as far as I know is specific to the pm.NUTS step method. Have you checked the MCSE estimates to make sure such number of draws is actually required?