Make dynamic code work with offline mode
# What does this PR do?

Using dynamic code on the Hub won't work in offline mode if the model is cached. This is because of an old way of getting the commit hash I put there before we had the commit hash returned in the e-tag. Now it's very easy to get it, so this PR changes the line of code and adds a test to make sure we don't regress.

cc @VictorSanh and @leot13 since you reported the bug.
Thank you!!!<|||||>_The documentation is not available anymore as the PR was closed or merged._