update load_from_state_dict
Browse files
modeling_hf_nomic_bert.py
CHANGED
@@ -60,10 +60,14 @@ def state_dict_from_pretrained(model_name, safe_serialization=False, device=None
|
|
60 |
load_safe = True
|
61 |
else: # Try loading from HF hub instead of from local files
|
62 |
weight_name = WEIGHTS_NAME if not safe_serialization else SAFE_WEIGHTS_NAME
|
63 |
-
resolved_archive_file = cached_file(
|
|
|
|
|
64 |
if resolved_archive_file is None:
|
65 |
weight_index = WEIGHTS_INDEX_NAME if not safe_serialization else SAFE_WEIGHTS_INDEX_NAME
|
66 |
-
resolved_archive_file = cached_file(
|
|
|
|
|
67 |
if resolved_archive_file is not None:
|
68 |
is_sharded = True
|
69 |
|
|
|
60 |
load_safe = True
|
61 |
else: # Try loading from HF hub instead of from local files
|
62 |
weight_name = WEIGHTS_NAME if not safe_serialization else SAFE_WEIGHTS_NAME
|
63 |
+
resolved_archive_file = cached_file(
|
64 |
+
model_name, weight_name, token=True, _raise_exceptions_for_missing_entries=False
|
65 |
+
)
|
66 |
if resolved_archive_file is None:
|
67 |
weight_index = WEIGHTS_INDEX_NAME if not safe_serialization else SAFE_WEIGHTS_INDEX_NAME
|
68 |
+
resolved_archive_file = cached_file(
|
69 |
+
model_name, weight_index, token=True, _raise_exceptions_for_missing_entries=False
|
70 |
+
)
|
71 |
if resolved_archive_file is not None:
|
72 |
is_sharded = True
|
73 |
|