Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

add support for binary model loading through browser http handler #1207

Merged
merged 6 commits into from
Aug 6, 2018

Conversation

pyu10055
Copy link
Collaborator

@pyu10055 pyu10055 commented Aug 5, 2018

Description

this would allow frozen model to be load through http io handler, which checks fetch polyfill.


For repository owners only:

Please remember to apply all applicable tags to your pull request.
Tags: FEATURE, BREAKING, BUG, PERF, DEV, DOC, SECURITY

For more info see: /~https://github.com/tensorflow/tfjs/blob/master/DEVELOPMENT.md


This change is Reviewable

@pyu10055 pyu10055 requested a review from caisq August 5, 2018 06:10
Copy link
Collaborator

@caisq caisq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 approvals obtained (waiting on @pyu10055 and @caisq)


src/io/browser_http.ts, line 53 at r1 (raw file):

length

nit: s/length/a length/

Also, it would be helpful to print out the actual length of of path here, because that helps user debugging their code.


src/io/browser_http.ts, line 137 at r1 (raw file):

private

Maybe slightly better to make it protected, to make inheritance possible in the future.


src/io/browser_http.ts, line 147 at r1 (raw file):

let weightSpecs: WeightsManifestEntry[];

There is a lot of code duplication between this method and loadJSONModel() in terms of the weight-loading code. Can you factor the code out into a separate private method, perhaps called loadWeights()


src/io/browser_http.ts, line 173 at r1 (raw file):

private 

Same as above. Maybe slightly better to make it protected.

Copy link
Collaborator

@caisq caisq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 approvals obtained (waiting on @pyu10055 and @caisq)


src/io/browser_http.ts, line 52 at r1 (raw file):

path.length === 2,

In addition, add a unit test for this error condition.

Copy link
Collaborator Author

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 approvals obtained (waiting on @caisq and @pyu10055)


src/io/browser_http.ts, line 52 at r1 (raw file):

Previously, caisq (Shanqing Cai) wrote…
path.length === 2,

In addition, add a unit test for this error condition.

there is a unit test at the end of the test file.


src/io/browser_http.ts, line 53 at r1 (raw file):

Previously, caisq (Shanqing Cai) wrote…
length

nit: s/length/a length/

Also, it would be helpful to print out the actual length of of path here, because that helps user debugging their code.

Done.


src/io/browser_http.ts, line 137 at r1 (raw file):

Previously, caisq (Shanqing Cai) wrote…
private

Maybe slightly better to make it protected, to make inheritance possible in the future.

Done.


src/io/browser_http.ts, line 147 at r1 (raw file):

Previously, caisq (Shanqing Cai) wrote…
let weightSpecs: WeightsManifestEntry[];

There is a lot of code duplication between this method and loadJSONModel() in terms of the weight-loading code. Can you factor the code out into a separate private method, perhaps called loadWeights()

Done.


src/io/browser_http.ts, line 173 at r1 (raw file):

Previously, caisq (Shanqing Cai) wrote…
private 

Same as above. Maybe slightly better to make it protected.

Done.

Copy link
Collaborator

@caisq caisq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 approvals obtained (waiting on @caisq and @pyu10055)


src/io/browser_http.ts, line 151 at r2 (raw file):

      for (const entry of weightsManifest) {
        weightSpecs.push(...entry.weights);

Can these lines be factored into loadWeightData as well?

Copy link
Collaborator Author

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 approvals obtained (waiting on @caisq)


src/io/browser_http.ts, line 151 at r2 (raw file):

Previously, caisq (Shanqing Cai) wrote…
      for (const entry of weightsManifest) {
        weightSpecs.push(...entry.weights);

Can these lines be factored into loadWeightData as well?

Done.

Copy link
Collaborator

@caisq caisq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm_strong:

Reviewable status: 0 of 1 approvals obtained (waiting on @caisq)

@pyu10055 pyu10055 merged commit 53bfcfe into master Aug 6, 2018
@pyu10055 pyu10055 deleted the frozen_model_iohandler branch August 6, 2018 20:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants