-
|
Example 31 shows how to use model.drift_analog_weights() with InferenceRPUConfig. But I didn't find example for SingleRPUConfig (which I used for in-situ training). I tried to modify the rpu_config into But I can't see the drift of weights along time. Does in-situ training with ReRamSBPresetDevice support modeling drift during inference? If yes, could you provide an example? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
Can you give me a minimal working example that I can quickly run? |
Beta Was this translation helpful? Give feedback.
-
This is my code modified based on example 31_custom_drift_models I want to know how to simulate drift on AnalogTile just as on InferenceTile. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks. This does not seem to be supported at the moment, sorry. @maljoras, maybe you know an elegant way to resolve this? |
Beta Was this translation helpful? Give feedback.
-
|
Hi @alexxchen, Inference type drift is different from the in-situ training in aihwkit. In the in-situ training, it is indeed assumed that long-term drift does not matter, as weight updates are made on a much smaller time-scale. That said, I agree that there is a use case of trying to estimate the effect of long-term drift after analog in-situ training. While the direct conversion of a in-situ training from aihwkit.nn import AnalogWrapper
rpu_config = ReRamSBPreset(device=ReRamSBPresetDevice()
analog_model = create_my_model(rpu_config= rpu_config) # your model creation function
# [...] train the analog_model using analog in-situ training
# after training:
inference_rpu_config = InferenceRPUConfig(mapping=rpu_config.mapping, forward = rpu_config.forward)
# see example 34 for additional settings to get ReRAM like inference noise
inference_model = create_model(rpu_config=inference_rpu_config)
# make sure that you have the analog wrapper utility
weight_dic = AnalogWrapper(analog_model).get_weights()
inference_model = AnalogWrapper(inference_model).set_weights(weight_dic)
# now use the inference_model for estimating drift
inference_model.drift_analog_weights()Note however, that with this approach you have to make sure that the architecture is defined similarly. e.g. the |
Beta Was this translation helpful? Give feedback.
Hi @alexxchen,
Inference type drift is different from the in-situ training in aihwkit. In the in-situ training, it is indeed assumed that long-term drift does not matter, as weight updates are made on a much smaller time-scale. That said, I agree that there is a use case of trying to estimate the effect of long-term drift after analog in-situ training. While the direct conversion of a in-situ training
RPUConfigtoInferenceRPUConfigis not supported yet (as there are many details how the in-situ training could be implemented), what you can do is to extract the full weights (without realistic read) from the trained model and then set it in the inference model. So something like