Accurate rolling bearing remaining useful life (RUL) prediction is extremely important to assure the machine’s safety and decrease damage repair. To improve the accuracy of rolling bearing RUL prediction, proposed a bearing RUL prediction method based on the Transformer model, made full use of its self-attention mechanism and the advantages of encoder-decoder structure, solved the memory degradation problem caused by the too-long sequence in bearing RUL prediction, found out the dependent relationship between the input feature and the bearing degradation degree. Meanwhile, trigonometric function transform and cumulative transform are used to correct the feature's monotony and tendency, representing the rolling bearing degradation process better. The average absolute error of RUL prediction based on the Transformer model is reduced by 9.25%, 28.63%, and 34.14%, while the average ss were increased by 2.78%, 19.79%, and 29.38%, according to experimental results on the PHM2012 dataset. Experimental results on the XJTU-SY dataset showed that compared with other prediction methods, the proposed model is reduced by 17.4%, and the average ss were increased by 18.6%, which indicates higher feasibility and superiority.