Hi BraTS organizers, We are using multiple models to obtain inferences and perform post-processing with their outputs for final results. Could you advise us on how to handle different environments? We could not find any descriptions in the MLCube instructions or documents.

Created by kimbab
@hasank I appreciate your help with this. We now are testing how to set up multiple conda environments from Docker.
Hello @kimbab This doesn't sound like an MLCube constraint. If something can be done using docker but can't be done with MLCubes, then it's an MLCube constraint. It's a containerization challenge when one needs multiple conflicting environments but is supposed to create a single immutable container that doesn't have network access to install packages during runtime. This network access constraint is because your model will be evaluated on private data, so the challenge organizers need to make sure the execution is secure; hence they don't give your container internet access during runtime, otherwise, the private data could be at risk. A solution for your issue is to have all environments installed in the container, and then have a custom entrypoint that will sequentially run your models/workloads while dynamically choosing which virtual environment to activate. To make the idea more clear, here is a hypothetical example. Suppose you have models m1, m2, and m3, each needs a separate environment to run: - Install and setup three python environments in your dockerfile. Say they are named `env1`, `env2`, and `env3`. - Create a usual `mlcube.py` entrypoint for each model you have. Say they are `mlcube1.py, mlcube2.py, and mlcube3.py`. Each entrypoint will have the role of calling the associated model. - Create an intermediate entrypoint, call it `entrypoint.sh`, which will do something like this: ``` #!/bin/sh activate env1 python mlcube1.py $@ activate env2 python mlcube2.py $@ activate env3 python mlcube3.py $@ ``` - Make sure that `entrypoint.sh` is set as the entrypoint in your dockerfile. The following could be a helpful resource, as we were working recently on a project that required multiple environments to be run: - An example Dockerfile installs and setup multiple environments, using python's venv (https://github.com/hasan7n/medperf/blob/fl-poc/examples/fl_post/fl/project/Dockerfile). - An example custom entrypoint: https://github.com/hasan7n/medperf/blob/fl-poc/examples/fl_post/fl/project/entrypoint.sh. This entrypoint is choosing a suitable environment to run a single script. Your usecase is different, but this may help you shape your custom entrypoint.
@vchung @ujjwalbaid I have just sent the email as advised. For transparency and in case other participants prefer open communication, I am including a copy of the email below. === We are working with multiple models, each requiring different environments due to package version conflicts. Our current approach involves sequentially obtaining inferences and installing/uninstalling packages for each model. However, we are concerned about whether this approach will be feasible within the constraints of MLcube. So far, we have not had success and could not find any relevant documentation or sources to guide us. Given the complexity of managing these different environments and the deadline approaching tonight, could you please advise if there is a possibility to extend the deadline? Alternatively, if there is another solution or format for submission that could accommodate our situation, we would greatly appreciate your guidance.
Hi @kimbab , Can you follow up with Ujjwal at ubaid@iu.edu regarding your request?
Dear Organizers, @jeffrudie @maria.correiadeverdier @rsaluja @vchung Could you please consider extending the deadline or providing an alternative solution for the MLcube problem in this thread? Thank you.
@vchung Hi, Could you please let us know if there is a solution available to handle this? As you are aware, the deadline is tonight. Is there a possibility of extending the deadline by a day or two, or allowing us to submit in a different format?
Hi @kimbab , I unfortunately don't have the right and/or enough expertise to guide this situation. I did, however, forward your question over to the MedPerf team in case they may have alternative solutions / ideas.
@vchung Hi Verena, could you please advise on this matter?
One environment cannot be used because each model requires a different environment (some of the required packages have version conflicts). Currently, we are considering sequentially obtaining inferences and installing/uninstalling packages before each model's inference. Would this approach work for MLcube?
@kimbab , If I understand correctly, your final model will require multiple environments within a single container? Is it possible to create one general environment that would work with all of the models?

Managing Different Environments for Multiple Models page is loading…