Fix load from PT-formatted checkpoint in composite TF models
# What does this PR do?

This PR fixes the slow test `TFViT2GPT2EncoderDecoderModelTest::test_real_model_save_load_from_pretrained` which was broken by the new `safetensors` integration. The main problem was that this model loads a GPT-2 as its decoder, which has a safetensors checkpoint formatted in a PyTorch-like format, and that model was loaded with wrong weight names.

Moving the variable scope code before we try to load PyTorch-like checkpoints fixes the issued.
_The documentation is not available anymore as the PR was closed or merged._