[Help me] Output model of xgb.train is not deterministic in Python

I trained a xgboost model in a python notebook. After fixing random seed of numpy, random state, seed in params of xgboost.train, I create a cell for training model from a pre-trained model. The code in the cell like that:

model = xgb.train(params, dtrain, num_boost_round=1000, early_stopping_rounds=20, xgb_model=initialized_model)
print(model.tree_to_dataframe().Tree.unique().shape[0])

The cell returns a xgboost model and prints the number of trees in the model.
The problem is in the same jupyter session, each time I run this cell it prints a different number of trees in the trained model. However, if I restart the session, the first time I run the cell in a new session will return the same number of trees.
Does anyone can give me an explanation and a solution to control the output of the cell in the same session?

Thank you so much!!!