R
Railway•6mo ago
The Uncluded

Deployment Failures

With no time to spare let's hop into the details: I have to present this application in front of recruiters and stuff in like 12 hours. github repo I'm using (my team and I's work): https://github.com/CTP-DS330-One-of-a-Kind/What-Up-Dog/tree/main deployment error im receiving: application failed to respond
GitHub
GitHub - CTP-DS330-One-of-a-Kind/What-Up-Dog: What up dog utilizes ...
What up dog utilizes a variety of models to not only predict the emotion your dog is experiencing in a picture you upload, but also will generate text based on environmental factors and the dog&amp...
95 Replies
Percy
Percy•6mo ago
Project ID: N/A
The Uncluded
The Uncluded•6mo ago
551b214
Brody
Brody•6mo ago
the project id is a uuid v4, so thats wrong, but it doesnt matter, you really only need to provide those for platform issues
The Uncluded
The Uncluded•6mo ago
ok, first time using this app or deploying really so expect noob mistakes
Brody
Brody•6mo ago
no worries, getting the solution ready now is your model.pkl file in git lfs?
The Uncluded
The Uncluded•6mo ago
LFS as in the largefilesystem thing? Yers Yes*
Brody
Brody•6mo ago
railway wont pull files from git lfs, youd need to host that file elsewhere and download it yourself. but you would also still need to add this as a railway.json file to your project.
{
"$schema": "https://schema.up.railway.app/railway.schema.json",
"deploy": {
"startCommand": "gunicorn app:app"
}
}
{
"$schema": "https://schema.up.railway.app/railway.schema.json",
"deploy": {
"startCommand": "gunicorn app:app"
}
}
The Uncluded
The Uncluded•6mo ago
mm ok, any ideas on how to host it? It's a crucial model for this app adding that to root now
Brody
Brody•6mo ago
are you sure its on lfs? nothing on the page tells me its in lfs?
The Uncluded
The Uncluded•6mo ago
uhh i mean it should be it's over the limit when i would drag and drop (ik bad practice)
Brody
Brody•6mo ago
its 100mib or more for git lfs i think so i dont think its in git lfs
The Uncluded
The Uncluded•6mo ago
falls short then by .8mb lol 1.7mb*
Brody
Brody•6mo ago
6.26mib* 98.3 mb -> 93.74 mib 100 mib - 93.74 mib = 6.26mib -> 6.56mb either way, let me know how adding that railway.json file works out
The Uncluded
The Uncluded•6mo ago
lol will do
Brody
Brody•6mo ago
i should note by saving files into this folder https://github.com/CTP-DS330-One-of-a-Kind/What-Up-Dog/blob/main/app.py#L6 you are saving the files into the containers ephemeral storage and anything you save there will not persist between deployments, to persist data between deployments you must use a volume https://docs.railway.app/reference/volumes
The Uncluded
The Uncluded•6mo ago
Persistance (thankfully) is not needed. im having issues with the push
Brody
Brody•6mo ago
okay good, just thought id mention
The Uncluded
The Uncluded•6mo ago
railway.json becomes untracked each time its added to project root
Brody
Brody•6mo ago
github is hard
The Uncluded
The Uncluded•6mo ago
for real though
Brody
Brody•6mo ago
thats why i use github desktop
The Uncluded
The Uncluded•6mo ago
ok its pushed will test now well it decided to push it to my personal account but whatever
The Uncluded
The Uncluded•6mo ago
GitHub
GitHub - theUncluded/final_dog
Contribute to theUncluded/final_dog development by creating an account on GitHub.
Brody
Brody•6mo ago
haha well you gotta get the file into the repo that railway is deploying from also, this is an ai thingy, you will likely need more than the trail accounts max 512mb of ram to run it
The Uncluded
The Uncluded•6mo ago
Yes, willing to throw money at this problem rn
Brody
Brody•6mo ago
sounds good 😆
Brody
Brody•6mo ago
i mean i dont see a railway.json file in the repo you linked at first?
The Uncluded
The Uncluded•6mo ago
its in finaldog , most recent one i linked
Brody
Brody•6mo ago
but is railway deploying from that repo?
The Uncluded
The Uncluded•6mo ago
yes it is deploying from final_dog set it up when it sent here
Brody
Brody•6mo ago
can you send both your build and deploy logs https://bookmarklets.up.railway.app/log-downloader/
Brody
Brody•6mo ago
in the orignal repo you linked you did have gunicorn in the requirements.txt file, but in the new repo you dont
The Uncluded
The Uncluded•6mo ago
ok will update rn re-init ing , building , deploying same deal, app failed to respond
Brody
Brody•6mo ago
both logs again please
The Uncluded
The Uncluded•6mo ago
build seems to pass, errors out near the end of what i assume deployment is
Brody
Brody•6mo ago
FileNotFoundError: [Errno 2] No such file or directory: 'gpt_api.txt'
The Uncluded
The Uncluded•6mo ago
oh my lord
Brody
Brody•6mo ago
looks like you are trying to store your open ai key in a text file?
The Uncluded
The Uncluded•6mo ago
yes i forgot to do the environmental var
Brody
Brody•6mo ago
put the key into your service variables (make sure to cancel the popup) then remove these two lines https://github.com/theUncluded/final_dog/blob/main/util/load_models.py#L41-L42
The Uncluded
The Uncluded•6mo ago
Updated, environ set, redoing the 10m process
Brody
Brody•6mo ago
any idea why your image is 5 something gigabytes?
The Uncluded
The Uncluded•6mo ago
uh where at?
Brody
Brody•6mo ago
haha read your build logs you have the model.pkl file but thats only 98mb do you have a bunch of other large files elsewhere in the repo?
The Uncluded
The Uncluded•6mo ago
yeah wtf, my only guess would be all the dependances .. but im really at a loss for that one
Brody
Brody•6mo ago
you only have a 7 line requirements.txt file
The Uncluded
The Uncluded•6mo ago
apologies, ive been trying to deploy this for about 7 hours straight.
Brody
Brody•6mo ago
i think its the timm package "It comes packaged with >700 pretrained models, and is designed to be flexible and easy to use."
The Uncluded
The Uncluded•6mo ago
You know timm was just added today and both myself and the other ml dev dont know where its used was probably where the other dude got his model from tbh\ only guesses though irdk
Brody
Brody•6mo ago
well then you could save 5gb and drop your deploy time down to a tiny fraction of what it is right now
The Uncluded
The Uncluded•6mo ago
lets see if i remove import and timm req after this deploy run
Brody
Brody•6mo ago
sounds good
The Uncluded
The Uncluded•6mo ago
already see it in the deploy logs
Adam
Adam•6mo ago
Hi, resident python guy here. What's the issue?
The Uncluded
The Uncluded•6mo ago
raise OpenAIError( openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable a lot lol well it seems to really just be my api
Brody
Brody•6mo ago
did you set a OPENAI_API_KEY service variable?
The Uncluded
The Uncluded•6mo ago
yes
Adam
Adam•6mo ago
set the OPENAI_API_KEY variable and if that doesn't work, API_KEY = os.getenv("OPENAI_API_KEY") and pass that through to the api
The Uncluded
The Uncluded•6mo ago
and removed the lines
The Uncluded
The Uncluded•6mo ago
gonna trim timm rq pushed, reinit ing longest deployment yet without timm
Brody
Brody•6mo ago
is the image still 5gb?
The Uncluded
The Uncluded•6mo ago
checking rn
Adam
Adam•6mo ago
It's very weird how long your deployments are taking
Brody
Brody•6mo ago
their images are 5gb so the time isnt too odd
The Uncluded
The Uncluded•6mo ago
deployment isnt done but I dont see the image thing in here unless if im blatantly blind
Adam
Adam•6mo ago
The image hasn't published yet
The Uncluded
The Uncluded•6mo ago
oh
Adam
Adam•6mo ago
There'll be more lines
The Uncluded
The Uncluded•6mo ago
ok whoops
Brody
Brody•6mo ago
#1 [internal] load build definition from Dockerfile

#1 ...

#2 [internal] load .dockerignore

#2 transferring context: 2B done
#2 ...

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile:

#1 transferring dockerfile: 2.09kB done

#1 DONE 370.0s
#1 [internal] load build definition from Dockerfile

#1 ...

#2 [internal] load .dockerignore

#2 transferring context: 2B done
#2 ...

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile:

#1 transferring dockerfile: 2.09kB done

#1 DONE 370.0s
370 seconds, very odd but this isnt your doing
The Uncluded
The Uncluded•6mo ago
well glad I didnt do that one haha same deal image is there
Brody
Brody•6mo ago
still 5 something gb?
The Uncluded
The Uncluded•6mo ago
yeah, so strange
Adam
Adam•6mo ago
The error this time is that you removed timm and a section of your code still expects it. I don't think reducing the image size is the way to go here, let's just get your app hosted and you can worry about optimizations later
The Uncluded
The Uncluded•6mo ago
yeah seems like timm is a requirement gonna re add
Adam
Adam•6mo ago
While you're at it, do what I said above here
The Uncluded
The Uncluded•6mo ago
that should be done already
Adam
Adam•6mo ago
Instead of opening your text file to retrieve the key, use os.getenv
The Uncluded
The Uncluded•6mo ago
redoing everything im still getting the same api error
Brody
Brody•6mo ago
The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable from the looks of your code, you arent doing the first option https://github.com/theUncluded/final_dog/blob/main/util/load_models.py#L41 but setting OPENAI_API_KEY in the service variables should work, since they are injected into the containers environment, that makes me think you didnt set the service variable properly or did a typo
The Uncluded
The Uncluded•6mo ago
that api key works tested local
Brody
Brody•6mo ago
uh you spelt it wrong
The Uncluded
The Uncluded•6mo ago
bruh motherfuck
Brody
Brody•6mo ago
well not spelt but you know
The Uncluded
The Uncluded•6mo ago
yeah ty talk to yall in 10 omfg it worked thank you
Brody
Brody•6mo ago
woohoo!!