rkmtlab / LipLearner

Research repository for LipLearner: Customizable Silent Speech Interactions on Mobile Devices (CHI 2023).
MIT License
55 stars 5 forks source link

Error loading weights: unpickling stack underflow #1

Open mohammed-elhaj opened 4 months ago

mohammed-elhaj commented 4 months ago

Issue: Error Loading Weights: Unpickling Stack Underflow Description I encountered an error while trying to load the provided model weights (weight.bin/weight.pt). The error message is as follows:

UnpicklingError: unpickling stack underflow Steps to Reproduce Download the pre-trained weights from the provided link using the following command:

!gdown --id 1RK7no1QH8QFZzjVrmg64X8wuCLRfJzu3 -O weight.pt Attempt to load the weights using the following code:

import torch

file_path = 'weight.pt'

try: weights = torch.load(file_path, map_location=torch.device('cpu')) print("Weights loaded successfully.") except Exception as e: print(f"Error loading weights: {e}") The following error is encountered:

UnpicklingError: unpickling stack underflow

File Information

Downloaded file size: 119,067,176 bytes File content preview (first 10 bytes): b'\x98\x00\x00\x00\x02\x00\x00\x00\x00\x00' System Information OS: Google Colab (Linux) Python version: 3.10 PyTorch version: 1.11.0+cu113 Torchvision version: 0.12.0+cu113

Troubleshooting Steps Taken Verified the file size and content. Attempted to load the file using both torch.load and pickle.load with no success. Re-downloaded the file multiple times to ensure it was not corrupted during the download process. Request Please provide guidance on the correct method to load the weights or verify if the provided weight file is correct. If there are specific steps or requirements to load the weights, kindly include those in the repository's documentation.

Thank you for your assistance!

amadeusuzx commented 1 month ago

Hi @mohammed-elhaj , sorry for the late reply! The model is a traced ONNX model which is optimized for running on iOS with the CoreML framework, so it cannot be loaded using pytorch. I can share the original pytorch model if you still need it.

mohammed-elhaj commented 1 month ago

Hi @amadeusuzx ,

Thank you so much for your response, and for all the incredible work you've done! Your paper has been the best resource I've come across, and it's been a huge help in my project, where I’m developing a lip-reading model for a disabled friend.

I’d really appreciate it if you could share the original PyTorch model, as it would be a great asset to my work. Additionally, if you have any advice on training a classification layer for recognizing alphabetical letters with limited data (to avoid overfitting), that would be incredibly helpful.

Thanks again for your time and support!

Best, Mohammed Elhaj

amadeusuzx commented 1 month ago

Hi @mohammed-elhaj, I just uploaded the original PyTorch model pretrained on the LRW using contrastive learning. https://drive.google.com/file/d/1_R3X8-hIPWAUDsIqaM94VRZ8KtJCL0lG/view?usp=sharing This should be a good start point to fine-tune the model for your custom vocabulary with limited data. I am very happy you found the paper and the repo helpful, and I hope all the best for you and your friend!