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

Consolidate MemoryBundle #338

Open
jerinphilip opened this issue Feb 7, 2022 · 1 comment
Open

Consolidate MemoryBundle #338

jerinphilip opened this issue Feb 7, 2022 · 1 comment

Comments

@jerinphilip
Copy link
Contributor

The following free functions should consolidate into a class that deals with all MemoryBundle troubles. The lifetime of the said class attached with the translation model feels like a sensible thing to do. Anything further inside can use a reference or pointer to the said class.

AlignedMemory loadFileToMemory(const std::string& path, size_t alignment);
AlignedMemory getModelMemoryFromConfig(marian::Ptr<marian::Options> options);
AlignedMemory getQualityEstimatorModel(const marian::Ptr<marian::Options>& options);
AlignedMemory getQualityEstimatorModel(MemoryBundle& memoryBundle, const marian::Ptr<marian::Options>& options);
AlignedMemory getShortlistMemoryFromConfig(marian::Ptr<marian::Options> options);
AlignedMemory getSsplitPrefixFileMemoryFromConfig(marian::Ptr<marian::Options> options);
void getVocabsMemoryFromConfig(marian::Ptr<marian::Options> options,
std::vector<std::shared_ptr<AlignedMemory>>& vocabMemories);
bool validateBinaryModel(const AlignedMemory& model, uint64_t fileSize);
MemoryBundle getMemoryBundleFromConfig(marian::Ptr<marian::Options> options);

With this consolidation, we may also address

  1. A format for model packaging
  2. Enforced ssplit file. ssplit file is not a vital requirement at the moment and is currently not provided at the extension.

However, it will be easier to consolidate and take on the packaging and breaking changes in a second iteration.

@XapaJIaMnu
Copy link
Collaborator

Can we piggy back this: XapaJIaMnu/translateLocally#89
We should do a "best-effort" load strategy with some warnings if something is missing, rather than falling flat when we can deliver some user experience.

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

2 participants