We provide unsupervised machine learning (ML) schemes based on autoencoders for unconstrained beamforming (BF) and hybrid BF in millimeter-waves (mmWaves). An autoencoder is a powerful unsupervised ML model, and it is used to reconstruct the input with a minimal error by finding a low-dimensional representation of the input. In this paper, we present a linear autoencoder for finding the beamformers at the transmitter (Tx) and receiver (Rx), which maximize the achieved rates over the mmWave channel. Since the autoencoder has a close relationship with the singular value decomposition (SVD), we first study autoencoders for unconstrained BF based on SVD. In hybrid BF, beamformers are designed by using finite-precision phase shifters in the radio frequency (RF) domain along with power constraints. Therefore, we propose a hybrid BF algorithm based on autoencoders, which incorporates these constraints. We present our simulation results for both unconstrained BF as well as hybrid BF, and compare their performance with state-of-the-art. By using the stochastic and NYUSIM channel models, we achieve 30 - 40% and 60 - 70% gains in rates with the proposed autoencoder based approach compared to the supervised hybrid BF with the stochastic and NYUSIM channel models, respectively.