question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature request] Using a single Torch binary for all the model related content

See original GitHub issue

🚀 Feature Description

We consider using a single torch binary file as the model release format as opposed to the current zip files compressing all the other files used by a model at inference.

It’d help to keep things more compact and easy to manage by the ModelManager such as avoiding setting the relative paths of the dependencies (normalization stats, speaker IDs, etc.) in the config.json.

Solution

We’ll use a single model.pth that includes all the data dependencies and the model itself. Then you can access the content as python attributes like

import torch
chkp = torch.load("model.pth.tar")
speaker_ids = chkp['speaker_ids']
speaker_encoder = chkp['speaker_encoder']
...
model = chkp['model]'

So let us know what you think about this proposed change under this issue.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
erogolcommented, Dec 28, 2021
How would fine-tuning work? Say I want to FT an existing model with another dataset. I need to load the 1gb checkpoint in python do chkp['config']['datasets'][0] = BaseDatasetConfig(name="vctk", meta_file_train="", path="../VCTK/") then save a 1Gb copy of it if I don't want to overwrite the previous one, and then continue with that checkpoint? Instead of editing the config.json

@WeberJulian How about if we keep config.json separate?

How about having this compact format for inference only.

Nothing stays inference only 😄. Also, it creates a decoupling that we need to manage, maintain and book. IMO a single format that works everywhere (train, inference, fine-tune) is a more convenient and reliable approach.

1reaction
erogolcommented, Dec 23, 2021

Yep only a .pth file (same file but we don’t use .tar any more)

Yes we 'll update all the models the same way

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom handler request data #529 - pytorch/serve - GitHub
I'm using curl POST upload two images, and running handle function in torch serve. I found POST requests cost a large part of...
Read more >
Binary Classification Using New PyTorch Best Practices, Part 2
This is the second of two articles that explain how to create and use a PyTorch binary classifier. A good way to see...
Read more >
Share a model - Hugging Face
In this tutorial, you will learn two methods for sharing a trained or fine-tuned model on the Model Hub: Programmatically push your files...
Read more >
PyTorch Tutorial: How to Develop Deep Learning Models with ...
In this tutorial, you will discover a step-by-step guide to developing deep learning models in PyTorch. After completing this tutorial, you will ...
Read more >
2. Troubleshooting Guide - PyTorch
Refer to this section for common issues faced while deploying your Pytorch models using Torchserve and their corresponding troubleshooting steps. Deployment and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found