Skip to content

Error loading weights: unpickling stack underflow #1

@mohammed-elhaj

Description

@mohammed-elhaj

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions