Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

importing matlab.engine breaks pytorch-lightning model loading.

Aperta
#16 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
matlab, python, pytorch

Direzione di ricerca

Start with the minimal reproduction using matlab.engine before the LITModel import and inspect pytorch_lightning/core/saving.py, utilities/cloud_io.py, and torch/serialization.py at the traceback locations. Compare behavior with the imports reversed and verify the reported Python, PyTorch, PyTorch Lightning, MATLAB Engine, and Ubuntu versions. Done means the checkpoint loads successfully regardless of import order, or the compatibility limitation is clearly documented.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

It's difficult to assess what package is causing the issue, but i'm going to raise it here as this issue only happens when matlab.engine is imported.

Bug description

importing matlab.engine breaks pytorch_lightning ability to load a previously saved model.

This only happens when import matlab.engine is included in the script. The checkpoint_path is not empty.

How to reproduce the bug
import matlab.engine
from my_custom_model import LITModel # this is a pytorch_lightning.LightningModule model
chkpoint_path = '/path/to/my/checkpoint.ckpt'
model = LITModel.load_from_checkpoint(checkpoint_path=chkpoint_path)
Important
  • If the import of matlab.engine comes after the LITModel import, then the code does not error.
Error messages and logs
LITModel.load_from_checkpoint(chkpoint_path)
  File "/home/anaconda3/envs/torch/lib/python3.8/site-packages/pytorch_lightning/core/saving.py", line 139, in load_from_checkpoint
    checkpoint = pl_load(checkpoint_path, map_location=lambda storage, loc: storage)
  File "/home/anaconda3/envs/torch/lib/python3.8/site-packages/pytorch_lightning/utilities/cloud_io.py", line 47, in load
    return torch.load(f, map_location=map_location)
  File "/home/anaconda3/envs/torch/lib/python3.8/site-packages/torch/serialization.py", line 705, in load
    with _open_zipfile_reader(opened_file) as opened_zipfile:
  File "/home/anaconda3/envs/torch/lib/python3.8/site-packages/torch/serialization.py", line 243, in __init__
    super(_open_zipfile_reader, self).__init__(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: [enforce fail at inline_container.cc:106] . archive does not contain any files
Environment
- Linux: Ubuntu 22.04.1 LTS
- python==3.8.12
- pytorch_lightning==1.6.4
- torch==1.11.0
- matlabengine==9.13.1
- Matlab: R2022b
Lingua principale
Python
Stelle
97
Fork
13
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mathworks/matlab-engine-for-python

Tutte le issue di mathworks/matlab-engine-for-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.