Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give a pre-trained model that can be loaded directly using the ‘model_weights = torch.load(file_path, map_location='cpu')’ #9

Open
SHIBOYA opened this issue Oct 2, 2023 · 3 comments

Comments

@SHIBOYA
Copy link

SHIBOYA commented Oct 2, 2023

While trying to load the file using Python’s pickle module, I encountered an _pickle.UnpicklingError, stating that persistent IDs in protocol 0 must be ASCII strings. Here is the exact error message:

_pickle.UnpicklingError: persistent IDs in protocol 0 must be ASCII strings

I attempted to resolve the issue by employing various methods, including utilizing the persistent_load parameter with pickle.Unpickler and trying to load the file in different environments, but unfortunately, all efforts have been in vain.

Request for Assistance:
Given the circumstances, I was hoping you could provide some insights or guidance on the following points:

Creation Environment: Could you share details about the environment in which the file was created, including the Python and PyTorch versions used?
Persistent IDs: Any information or context regarding the persistent IDs encountered in the file would be immensely helpful.
Loading Method: If there is a specific method or procedure to correctly load the file, could you please share it with me?
Additional Details: Any other details or specifications about the file that you think might assist in resolving the issue would be greatly appreciated.

@gabrielilharco
Copy link
Contributor

Hi @SHIBOYA. We have our full env at environment.yml. You can install with the command below. Let me know if that solves your issues

conda env create
conda activate task-vectors

@SHIBOYA
Copy link
Author

SHIBOYA commented Oct 3, 2023

Thank you for your prompt response. I appreciate the guidance provided.

I'd like to inform you that I am indeed running the code within the environment specified in environment.yml. However, I've encountered an issue while trying to install open-clip-torch==2.0.2 using pip. The package seems to be unavailable or there might be some compatibility issues.

Given the challenges I've encountered, I was wondering if it might be possible for you to provide an alternative version of the finetuned model. Specifically, I am looking for a format that might be more universally compatible, such as an .npy file or any other format that can be easily loaded without the specific environment dependencies.

I understand that these issues can sometimes be intricate, and I truly appreciate your patience and assistance in this matter. I'm keen on resolving this to continue with my work.

Thank you once again for your support.

@gabrielilharco
Copy link
Contributor

That version of open clip exists (see https://github.com/mlfoundations/open_clip/releases/tag/v2.0.2), I can install it without problems on my side. If you have dependencies outside of this repository that are causing conflicts, one solution would be to do a clean installation of our requirements, load the model, and then save it in another format so you can load the way you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants