How to choose the good number dimension of autoencoder?
Treat it as a hyperparameter, and do a hyperparameter search over it. This requires having a good metric for your model performance. Which usually means having a validation set with labels. Training can still be unsupervised.