Closed wangtz closed 4 years ago
@pyu10055 @nsthorat @dsmilkov @caisq @kangyizhang Any thoughts?
@huan
Yes, that's a problem and the developers will be very sad if it could not be solved.
For example, when we want to use the Google Chrome Puppeteer in China, what we expect the developer to do is a npm install puppeteer
but it will fail eventually because after installing all the JS files from NPM server then it needs run a post-install script and wants to download the binary from the GCS storage server, which is not accessible in China because of the GFW.
There is a workaround for the puppeteer at here. I believe we should solve this kind of problem for the developers in China, for spreading the tfjs faster. (at least we should provide a workaround for installing tfjs-models)
+1 for solving this for developers in China. Most of our tfjs-models actually download weights from GCS at runtime. So I'm not sure if the puppeteer workaround @huan pointed out would work here.
I think our company can provide the models storage and CDN services in China . may accelerate this.
@chenqing That would be great if the npm.taobao.comnpm.taobao.org/mirrors
could provide the CDN service for our tfjs models.
Do you know any stakeholders from npm.taobao.com
who can make decisions on this issue? If you could introduce a key person for us, then we would be able to solve this issue easier.
@huan I think what's your said is https://npm.taobao.org/mirrors . I have talked with the maintainer. He promised to support it. The next question is what and how to synchronize.
That'll be awesome. Thanks Chenqing.
The first one coming out of my mind is probably rsync if that works on GCS?
@chenglu
Thanks @chenqing and @huan for the suggestion, as @caisq mentioned, our model npms do not have a post install script to download model files from gcs, and people can use jsdelivr directly on their pages, which will download the model files on the fly. Feels like the better way is to mirror GCS bucket, but not sure if that is possible.
thanks @wangtz, I was wondering if we could try the feature of "mirror storage"--镜像存储 that alioss or qiniu provided for unblocking the tfjs-models bucket? e.g. http://tfjs.oss-cn-hongkong.aliyuncs.com/tfjs-models/weights/posenet/mobilenet_v1_075/MobilenetV1_Conv2d_8_pointwise_biases
Thanks @chenqing and @huan for the suggestion, as @caisq mentioned, our model npms do not have a post install script to download model files from gcs, and people can use jsdelivr directly on their pages, which will download the model files on the fly. Feels like the better way is to mirror GCS bucket, but not sure if that is possible.
I think so .
@wangtz @huan @caisq https://cnpmjs.org/mirrors/tfjs-models/ has sync ok. and will automatic synchronization when update.
I think may mention this in some parts of the document?
@chenqing awesome, good job!
I found when installing ttf-node npm will down libtensorflow from googleapis.com too. see https://github.com/tensorflow/tfjs-node/blob/master/scripts/install.js#L33 Unfortunately, this url can't be visited normally in China. upload libtensorflow to npm may be a solution. @caisq
I came to ask where we can download those models to load them locally easier, but seeing this issue is very related I'll join here.
As a workaround what I did is opening the network developer tab, and copying the body of all the requests (one JSON, then N "shards"):
Then put them in your public
folder as static file:
Then you can load them using the option { modelUrl: '/objects/model.json' }
. Does anyone know a better way? Seems like an easy way of downloading these models would help OP as well. I'm looking to improve this for a React Hook I made, use-tensorflow
and currently I'm telling devs this way of loading those manually but it is painfully:
import React, { useRef } from "react";
import { useObjects } from "use-tensorflow";
import { Container, Box } from './components';
export default () => {
const ref = useRef(null);
const objects = useObjects(ref, { modelUrl: "/objects/model.json" });
return (
<Container>
<img ref={ref} src="/living-room.jpg" />
{objects.map(({ left, top, width, height, label, score }) => (
...
))}
</Container>
);
};
Closing this due to lack of activity, feel to reopen. Thank you
Currently for pre-tained models, the weights and model graph is not shipped with NPM and needs to fetched at runtime from GCS. However GCS is not available in China or very slow which hurts user experiences.
Do we have a plan to make pre-trained models available in China? I would suggest to embed pre-trained weights in a fat NPM (probably new NPMs to avoid breaking existing use cases). But we could definitely find a place to host these content in China as well.