Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting/Loading model and weights independently #47

Closed
viksit opened this issue Apr 16, 2016 · 3 comments
Closed

Exporting/Loading model and weights independently #47

viksit opened this issue Apr 16, 2016 · 3 comments

Comments

@viksit
Copy link

viksit commented Apr 16, 2016

Is there an example/pointers to a case where,

  • A model graph and its weights are exported separately? For instance, one graph but multiple datasets and thus, multiple weight files.
  • Would it be possible to load this model once, and initialize multiple versions of it using different weights for the Classify() to run?
@fangweili
Copy link
Contributor

fangweili commented Apr 18, 2016

No, we don't export graph and weights separately. For a graph with multiple "datasets", it should be exported as multiple "versions" of the same model. We want model exports to be self-contained. Besides, in most cases, the footprint of graph itself is relatively small/insignificant compared to its weights in serialized format.

Yes, multiple versions of a model can be loaded simultaneously and used by the same Classify() interface. We don't currently have an example for that. But you can implement it easily through either StaticManager (if you have a static list of versions to load) or custom FileSystemStoragePathSource (if you need capability of discovering new versions at runtime).

Could you tell us a bit more about the use case?

@viksit
Copy link
Author

viksit commented Apr 18, 2016

Ah, thanks @fangweili - the multiple versions of the model makes sense.

Basically, I have discrete datasets for predicting labels (via the same model) that are under a taxonomy, with sublabels.

eg,

model_id_1 predicts label1.sublabel1, label1.sublabel2
model_id_2 predicts label2.sublabel1, label2.sublabel2

The models may (or may not share) the same graph. I'm building this system to be flexible in case I need different graphs per use case, or re-use the same one across all of them.

I've created a new StorageSourcePath based system that can discover models within a file system, and my own version of the AspiredVersionManager that can load different models into memory. With this, I can,

  • Either have /data/modelid/0001..0004 where modelid can have one graph and versions have different weights (trained for different datasets)
  • Or, I can have /data/modelid/001, /data/modelid2/001 where the model IDs encode different graphs.

@fangweili
Copy link
Contributor

For "manager to load different models into memory", the recommended solution is to extend FileSystemStoragePathSource so that it "aspire" multiple versions instead of just the latest one. AspiredVersionManager will then keep the whole "aspired set" in memory - you don't have to change it.

@kirilg kirilg closed this as completed May 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants