-
Notifications
You must be signed in to change notification settings - Fork 264
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
Read model and vocabs from memory #192
Comments
Hi, Currently, the content of the model directory is an implementation detail and its structure could change in the future. I'm not sure when would you need to have the model files in memory? As you should load the actual files at some point, isn't it equivalent to build a |
I want to extract the files in memory as Another case I can think of is if someone wants to share vocabularies or vmaps among different models. |
I'm thinking we could add a
Then we add a new overload that accepts an instance implementing this interface. In you code, you would need to extend this base class and implement your own loading logic. I think there are ways to wrap a What do you think? |
That would be great! I need to get a bit deeper into the relevant classes and interfaces in the code, but I'd like to get a first grasp of your idea and the work this will involve: all these methods should be templates with arguments and the derived class will implement the conversion of these arguments into the right types, do I get it right? |
The main goal is to not integrate your loading logic into the main codebase, as it is very specific to your use case, but allow to plug it. Do you want to take this one? I can also implement it if you prefer. |
Actually a single method could be enough, assuming you could easily map a filename to a stream: std::unique_ptr<std::istream> get_file(const std::string& filename) |
Yes, absolutely, I get the general idea and it's great as long as I have a way to implement my logic.
I would love to work on that, but honestly you already have implemented it in your mind, along with alternatives :), so I would prefer and appreciate it if you could add it --it would save us great time and effort. Thank you! |
Hi @guillaumekln
I would like to load the model file from memory (in a
std::vector<unsigned char>
) but I think it's not possible as all related methods use at some point the model directory as anstd::string
. I can see the necessity in this, as the vocabularies and the vmap are also loaded from this directory.Still, do you think there could be a use case (apart from mine obviously :)) for some overrides with arguments that will accept
std::string
s pointing directly to the model and the vocabularies?The text was updated successfully, but these errors were encountered: