Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The pseudocode for the inference function contains a bug. #50

Open
lizhuoq opened this issue Dec 10, 2023 · 2 comments
Open

The pseudocode for the inference function contains a bug. #50

lizhuoq opened this issue Dec 10, 2023 · 2 comments

Comments

@lizhuoq
Copy link

lizhuoq commented Dec 10, 2023

# 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.

@198808xc
Copy link
Owner

198808xc commented Dec 13, 2023

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

@lizhuoq
Copy link
Author

lizhuoq commented Dec 13, 2023

Thank you for your reply, it's very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants