R
Railway12mo ago
moln

Unable to synchronously open file

When I try to load my model.h5 file it returns this error on the deploy logs. I am deploying a Flask app API and all other routes have been working fine except this one.
No description
Solution:
you would have to store the file in an S3 storage bucket, then have your code download the model file for you
Jump to solution
8 Replies
Percy
Percy12mo ago
Project ID: 03f47d59-4b7c-49e0-b503-80f3807edfca
moln
molnOP12mo ago
03f47d59-4b7c-49e0-b503-80f3807edfca this is the error shown in logs [2023-11-28 13:17:57,941] ERROR in app: Exception on /skan [POST] Traceback (most recent call last): File "/opt/venv/lib/python3.8/site-packages/flask/app.py", line 1455, in wsgi_app response = self.full_dispatch_request() File "/opt/venv/lib/python3.8/site-packages/flask/app.py", line 869, in full_dispatch_request rv = self.handle_user_exception(e) File "/opt/venv/lib/python3.8/site-packages/flask_cors/extension.py", line 176, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File "/opt/venv/lib/python3.8/site-packages/flask/app.py", line 867, in full_dispatch_request rv = self.dispatch_request() File "/opt/venv/lib/python3.8/site-packages/flask/app.py", line 852, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "/app/main.py", line 147, in skan model = load_model('model.h5') File "/opt/venv/lib/python3.8/site-packages/keras/src/saving/saving_api.py", line 238, in load_model return legacy_sm_saving_lib.load_model( File "/opt/venv/lib/python3.8/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler raise e.with_traceback(filtered_tb) from None File "/opt/venv/lib/python3.8/site-packages/h5py/_hl/files.py", line 562, in __init__ fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr) File "/opt/venv/lib/python3.8/site-packages/h5py/_hl/files.py", line 235, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5f.pyx", line 102, in h5py.h5f.open OSError: Unable to synchronously open file (file signature not found)
Brody
Brody12mo ago
how big is the model file?
moln
molnOP12mo ago
hi, i manually created the model architecture at the api and now i'm trying to only load the model weights, which is 172MB. i used git lfs to mount it on github
Brody
Brody12mo ago
just as I thought, railway does not support pulling files from git lfs
Solution
Brody
Brody12mo ago
you would have to store the file in an S3 storage bucket, then have your code download the model file for you
Brody
Brody12mo ago
I recommend cloudflare r2
moln
molnOP12mo ago
ill check on that, thanks
Want results from more Discord servers?
Add your server