[tfjs-converter] @tensorflow/tfjs 1.2.3 fails to load weights from the official GCP bucket due to CORS issues
See original GitHub issueTensorFlow.js version
1.2.3 & 1.2.2
Browser version
Chrome Version 77.0.3854.3 (Official Build) dev (64-bit) FireFox 69.0b4 (64-bit)
Bug report
Here is a minimalistic repo showing the bug.
Loading one of the PoseNet weights in the erroring
demo fails with:
Access to fetch at 'https://storage.googleapis.com/tfjs-models/savedmodel/posenet/mobilenet/quant2/100/group1-shard2of2.bin' from origin 'http://localhost:1234' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Both Chrome and FireFox allow the JSON file, but deny the loading of the model chunks. Using CORS Everywhere helps in FireFox.
This issue was first spotted in the context of semantic segmentation and text detection models loading weights from a non-official GCP bucket with the following CORS rules suggested by @nsthorat here:
[
{
"origin": ["*"],
"responseHeader": ["Content-Type"],
"method": ["GET", "HEAD"],
"maxAgeSeconds": 3600
}
]
I have tried imposing other rules as well, as described here, but the issue persists.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
javascript - TensorFlowJs & Google Storage | CORS Error with ...
In this specific case, you can configure the Google Cloud Storage bucket to allow resource requests between the bucket containing your ...
Read more >Google Cloud Storage Cors not working after enabling?
If you experience that the Google Cloud Cors is not working even after you did “gsutil cors set cors.json gs://your-bucket/”, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Loading from the official buckets should work now. I’m reverting a change that will fix this for any custom server.
hi @sdll @erikcartman
This is a bug in tfjs@1.2.3 and we will fix it soon.