Issue with Applying Drift During Inference Phase in AIHWKit #672
Replies: 1 comment 1 reply
-
Note that the drift model is never applied during training, so there is no need to have a flag. It will be only used for inference time. It is not clear from the above how the modified rpu_config is applied after training was done, before the inferfence. Is the model recreated while using the new rpu_config? There is a special flag to change the rpu_config during loading, otherwise the old rpu_config will be taken that is stored in the state_dict. You can also use the Also, there is a simpler form to apply the drift for the while model, simple use In this section, you should call weights_before_drift, _ = layer.get_weights()
print(f'Weights before drift for layer {idx} at t={t_inference}: {weights_before_drift}')
drift_analog_weights(tile, t_inference)
weights_after_drift, _ = layer.get_weights() |
Beta Was this translation helpful? Give feedback.
-
Dear AIHWKit Team,
I am currently working on a project where I need to apply a custom drift function during the training phase while avoiding the standard PCM noise model drift function only (while other noise type work normall). However, during the inference phase, I want to use the standard PCM noise model and allow all functions to work as intended. Despite my efforts, the drift does not seem to be applied correctly during the inference phase. Here is a brief overview of my approach and the problem I am encountering:
Custom Drift Function During Training:
I have implemented a custom drift function in a subclass of PCMLikeNoiseModel that disables drift during training while allowing other PCM noise model functionalities, such as programming and read noise, to work as standard.
The relevant code for the custom noise model and RPU configuration is as follows:
Standard PCM Noise Model During Training and Inference:
RPU Configuration:
During training, I use a separate RPU configuration that includes the custom noise model, and for inference, I re-enable the drift in the noise model using the standard PCMLikeNoiseModel.
Training RPU Configuration:
standard PCMLikeNoiseModel for Inference RPU Configuration:.
The RPU configuration for inference is as follows:
Problem:
Despite following the steps to apply drift during inference, the weights do not seem to change after applying drift_analog_weights, indicating that drift is not being applied. The debug output shows identical weights before and after applying drift.
Inference Phase Code:
Here is the relevant part of my code where I apply drift during the inference phase. I also tried using the
program_analog_weights
anddrift_analog_weights
functions according to the example, but drift is not working in any case.Could you please advise on how to ensure that the drift is correctly applied during the inference phase while avoiding it in the training phase? Any guidance or suggestions would be greatly appreciated.
Thank you for your assistance.
Beta Was this translation helpful? Give feedback.
All reactions