Household or building electricity load forecasting plays an important role for both consumers and electricity producers, but forecasting the electricity demand of individual energy consumers is challenging due to the inherent unpredictability and uncertainty of electricity loads. This paper proposes an LSTM model that combines an adaptive sliding window method with an attention mechanism. Add attention mechanism and sliding window features to improve the prediction accuracy of the model, especially for places where the trend of time series data changes greatly, it can better capture its complex time series patterns and trend changes. On this basis, this paper introduces a window size adaptive change method based on the neighborhood standard deviation, which describes the local change of the data in real time by calculating the standard deviation of the data in a given neighborhood, so that the model can automatically adjust the window size in real time to adapt to the input local features of the data. The performance of the proposed model is extensively compared with that of various baseline forecasting methods, and the comparisons show that the proposed model outperforms other electric load forecasting methods.