Disentangled VAE doesn't reconstruct accurate grids
First of all , this is a deepmind's paper , so the computational level they operate on is much higher.
Can you share your code files , so that I can see how you interpreted miyosuda's code.
The disentangled representation has to be scaled down so that the model trains , and gets useful results in atleast a few hours.

4GB is too less RAM for training any kind of model. The best temporary solution I can suggest is to perform the python script of distangled VAE on Colab Colab Notebooks

The more permanent solution that can making your model training much easier given your system constraints , is to use GCP or Azure.

How do you plan to customize the architecture once you finish implementing distangled VAE.