fix revision==fp16 fallback to main
This commit is contained in:
parent
93f965da40
commit
0eb4f5b86d
@ -983,7 +983,11 @@ def handle_from_pretrained_exceptions(func, **kwargs):
|
|||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
if "You are trying to load the model files of the `variant=fp16`" in str(e):
|
if "You are trying to load the model files of the `variant=fp16`" in str(e):
|
||||||
logger.info("variant=fp16 not found, try revision=fp16")
|
logger.info("variant=fp16 not found, try revision=fp16")
|
||||||
|
try:
|
||||||
return func(**{**kwargs, "variant": None, "revision": "fp16"})
|
return func(**{**kwargs, "variant": None, "revision": "fp16"})
|
||||||
|
except Exception as e:
|
||||||
|
logger.info("revision=fp16 not found, try revision=main")
|
||||||
|
return func(**{**kwargs, "variant": None, "revision": "main"})
|
||||||
raise e
|
raise e
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
previous_traceback = traceback.format_exc()
|
previous_traceback = traceback.format_exc()
|
||||||
|
Loading…
Reference in New Issue
Block a user