@julien-c proposal for TF/PT compat in hf_buckets

This commit is contained in:
thomwolf
2020-02-07 08:53:17 +01:00
parent d311f87bca
commit 961c69776f
2 changed files with 2 additions and 10 deletions

View File

@@ -303,11 +303,7 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin):
elif os.path.isfile(pretrained_model_name_or_path + ".index"):
archive_file = pretrained_model_name_or_path + ".index"
else:
archive_file = hf_bucket_url(pretrained_model_name_or_path, postfix=TF2_WEIGHTS_NAME)
if from_pt:
raise EnvironmentError(
"Loading a TF model from a PyTorch checkpoint is not supported when using a model identifier name."
)
archive_file = hf_bucket_url(pretrained_model_name_or_path, postfix=(WEIGHTS_NAME if from_pt else TF2_WEIGHTS_NAME))
# redirect to the cache, if necessary
try: