GithubHelp home page GithubHelp logo

Comments (14)

satra avatar satra commented on August 14, 2024

@gaiborjosue - take a look at this section: https://apptainer.org/docs/user/latest/docker_and_oci.html#cmd-entrypoint-behaviour

i'll try to create a simple miniconda/mamba container with multiple environments to see whether i can support this.

yes, to build singularity you have to be root, or you can use a docker apptainer container in privileged mode to build the recipe

from trained-models.

gaiborjosue avatar gaiborjosue commented on August 14, 2024

I will take a look at that right now. Thank you for the resource.

from trained-models.

gaiborjosue avatar gaiborjosue commented on August 14, 2024

Hello @satra, I was just wondering if your container testing supports the multi environment activation. I tested with cmd and entrypoint but it still does not work for me. Thank you!

from trained-models.

satra avatar satra commented on August 14, 2024

just like this example from the link above:

# CMD="date"

# Runs 'date'
$ apptainer run mycontainer.sif
Wed 06 Oct 2021 02:45:39 PM CDT

# Runs 'echo hello'
$ apptainer run mycontainer.sif echo hello
hello

can't you simply do:

$ apptainer run mycontainer.sif /path/to/conda/env/bin/python ...

from trained-models.

hvgazula avatar hvgazula commented on August 14, 2024

requires knowing the environment name ahead of time..meaning we either have to parse the file for the name or activate an environment that is not base. I still think..standardizing it by installing in base environment is easy and maintainable.

from trained-models.

hvgazula avatar hvgazula commented on August 14, 2024

I guess I am addressing a different issue 😄 . I will let @gaiborjosue respond first.

from trained-models.

gaiborjosue avatar gaiborjosue commented on August 14, 2024

Hello, I agree with Harsha. That would require us having to parse the conda env name somehow.

from trained-models.

satra avatar satra commented on August 14, 2024

supports the multi environment activation

i thought your question was about multiple environments, not a single environment. a single environment can be made default with CMD or ENTRYPOINT as demonstrated in the examples on apptainer.

another way of controlling environments is to modify the default environment in which a script is executed through controlling shebang #! . this can be done through a fit.sh or predict.sh script that wraps the python or other script the model provides. if the script wants different environments that's part of the ingest of script process. if it's simply a default environment then that can always be included in the CMD/ENTRYPOINT.

from trained-models.

gaiborjosue avatar gaiborjosue commented on August 14, 2024

@satra Thanks for the response. Yes, my question derivated from the suggestion of allowing users to have multiple environments for their model's dockerfile. Just in case they have different use-cases for the same model. However, in the current structure, cli does not activate a specific environment (other than base) automatically. Therefore, the problem was that we don't have any way of knowing which environment the user wants to activate for that specific use case scenario.

fit.sh or predict.sh

Also, per my understanding, cli when building the image, can't/does not run any .sh file. Therefore, the ideal thing would be to do it everything inside the Dockerfile. Is this possible?

from trained-models.

satra avatar satra commented on August 14, 2024

cli when building the image

the cli doesn't build an image right, it uses the image built from the dockerfile. so if the dockerfile has a few commands added that creates a startup script that can use appropriate environments in the image that should be fine.

  1. a docker image is essentially an OS, it can have many environments in it, including different conda environments.
  2. when calling a script inside the instance of that image, one can both initialize and refer to any of those environments.

it may be useful to write down the exact sets of commands of what it is you are trying to do with a specific image and we can work through that together. all of this should simply be a manipulation of scripts and entrypoints.

from trained-models.

hvgazula avatar hvgazula commented on August 14, 2024

@gaiborjosue I guess this is resolved as well. Isn't it?

from trained-models.

gaiborjosue avatar gaiborjosue commented on August 14, 2024

@hvgazula Right now, we are using base env at startup. Will work on this again, sorry if I have put this issue on hold.

from trained-models.

hvgazula avatar hvgazula commented on August 14, 2024

See here for why singularity image cannot activate the conda environment on entry.

from trained-models.

satra avatar satra commented on August 14, 2024

See here for why singularity image cannot activate the conda environment on entry.

most of that response is about layer reduction, which is irrelevant to the notion of conda environment activation. the only two instruction types that are relevant are CMD and ENTRYPOINT.

please see my comments here on how to achieve this: #75 (comment) (or discuss why that cannot be implemented).

from trained-models.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.