How to remove the intermediate layers of model

The cleanest approach would be to derive a custom model class from the model class as its base and override the forward method with your new definition.
I would not recommend to try to wrap submodules into an nn.Sequential container for models, which might be more complicated than a few sequential layers.