This is a common disadvantage of storing the model directly, as you would need to restore the exact same file structure.
Based on the error message it seems that the definition of ResNet9 is missing.
The recommended way it to only store the state_dict and recreate the model directly using:
model = ResNet9() # you would need the definition as an import or in the current script
model.load_state_dict(checkpoint['state_dict'])