Pangu-Weather
Pangu-Weather copied to clipboard
The pseudocode for the inference function contains a bug.
# Restore from uniformed output
output = output * weather_std + weather_mean
output_surface = output_surface * weather_surface_std + weather_surface_mean
# Stored the output for next round forecast
input_24, input_surface_24 = output, output_surface
input_6, input_surface_6 = output, output_surface
input_3, input_surface_3 = output, output_surface
The model's inputs and outputs are both normalized, and it is incorrect to de-normalize and store them during iterative inference. This would lead to errors in the next iteration. The correct approach is to de-normalize and return the outputs only after iterating through all time steps, i.e., de-normalize the output values after the loop is completed.
Hi,
Sorry for misleading you and other readers. The code was actually correct but not well organized. We integrated the normalization function into the model (e.g. PanguModel24()) as its first operation, but the output of the model was not de-normalized. This makes it necessary to manually add the de-normalization step outside the model function.
A side comment. The provided ONNX file has integrated both normalization and de-normalization, so the inference_xpu
code does not contain such steps. There is a kind of inconsistency, but the code and models are correct -- just for everyone's information.
Best, Lingxi
Thank you for your reply, it's very helpful.