(file_path, torch_dtype=None)
| 80 | |
| 81 | |
| 82 | def load_state_dict_from_bin(file_path, torch_dtype=None): |
| 83 | state_dict = torch.load(file_path, map_location="cpu", weights_only=True) |
| 84 | if torch_dtype is not None: |
| 85 | for i in state_dict: |
| 86 | if isinstance(state_dict[i], torch.Tensor): |
| 87 | state_dict[i] = state_dict[i].to(torch_dtype) |
| 88 | return state_dict |
| 89 | |
| 90 | |
| 91 | def search_for_embeddings(state_dict): |
no test coverage detected