cog
cog copied to clipboard
Copy files to use in `run` commands
run
commands in cog.yaml
can't use any of the user's files. It would be neat to allow this, in a way that could still be cached. Maybe you could define what files need copying somehow?
build:
run:
- copy: "foo.txt"
command: "echo foo.txt"
@dashstander Would this solve your problem with building things in setup.py?
Potentially? The only complication (that occurs to me) might be that, in the repo I'm working on right now, it might be necessary to also copy over all the files that need to be compiled. Or it might not? I'm really not sure. But if it were necessary then it'd potentially be a pain to go in and specify each file.
@charlesfrye I remember this is something you said you might need, but I can't remember why. I think it was generally bucketed under "need more Dockerfile control".
Hi! Just adding to this issue, my current use case for an AlphaPose model is requires compiling/building cuda extensions by manually running python setup.py build develop
.
Just talked to Andreas and he mentioned it's currently not implemented since the code is run after run
has been executed, would be great to have this + more Dockerfile control in general :)
I wonder if this actually solves the setup.py
problem. If all the source files need to be available in the source tree to make it work then it's going to make everything run very slowly locally because nothing will be cached. Each time you run cog run
it'll build the extensions.
@vccheng2001 how many source files need to be available to make setup.py build develop
? Is it the whole source tree, or is it just setup.py
and a couple of other things?
Maybe there's something smarter we can do here. Perhaps there's a way to have some commands that run after files are copied, but done in a different way when running locally to avoid the rebuild. 🤔
I don't know what I'm talking about here but...
I see that whenever I do anything with Cog, there's often a message along the lines of:
=> [stage-n p/q] COPY . /src
and my question is there a direct way to do this?
I'm often finding myself having to do cog run ...
commands to download all the model weights that I need, and other stuff...
Which is often a pain because I'm using an M1 (I don't have a proper GPU) so I have to flip between gpu: true
and gpu: false
in cog.yaml
.
So it'd be super nice to just copy files into the container directly.
Let me know your thoughts! 😅
P.S. Oh yeah,
I think this would help a lot, because I often use Google Colab to validate models are working and then containerise them (since that way I know the exact lib versions, etc.)
And a working Google Colab just so happens to have all the files I'll need in the container!