tianyic / only_train_once

OTOv1-v3, NeurIPS, ICLR, TMLR, DNN Training, Compression, Structured Pruning, Erasing Operators, CNN, Diffusion, LLM

Home Page:https://openreview.net/pdf?id=7ynoX1ojPMt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to load compressed model ?

WYYAHYT opened this issue · comments

The compressed model can't be loaded with the origin model shape, so the compressed model can't be applied, it can only be used to check accuracy after training.

Maybe the shape of compressed model can be saved for building corresponding model class.

Thanks for reaching out. You may find the solution, the compressed model can be directly loaded in most cases

compressed_model = torch.load(compressed_model_path)

Please note that there are some occasional cases that torch can not directly load model. In such case, we provide ckpt_format='onnx' to yield compressed model in onnx format.

oto.construct_subnet(
            out_dir=OUT_DIR,
            ckpt_format='onnx'
        )

See test_yolo_v5.