Skip to content

Support custom model URL #1027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

universeroc
Copy link

@universeroc universeroc commented Jul 19, 2022

I want to load a local model rather than tfhub.dev to improve the loading performance. But I can not load model except from tfhub.dev, so I make this patch to make it work, if there's another way to make it let me know, thank you in advance :)


This change is Reviewable

@google-cla
Copy link

google-cla bot commented Jul 19, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@pyu10055 pyu10055 requested a review from ahmedsabie August 30, 2022 16:23
Copy link
Contributor

@ahmedsabie ahmedsabie 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 @universeroc)


toxicity/src/index.ts line 37 at r1 (raw file):

 * `identity_attack` | `insult` | `threat` | `sexual_explicit` | `obscene`.
 * Defaults to all labels.
 * @param modelURL Load a model from URL rather than tfhub.dev

Rephrase it to "URL to load model from. Defaults to tfhub.dev.


toxicity/src/index.ts line 61 at r1 (raw file):

  }

  setModelURL(url: string) {

Please make this private

@universeroc universeroc force-pushed the master branch 2 times, most recently from 571a8bb to b08beb3 Compare September 21, 2022 09:56
Copy link
Contributor

@ahmedsabie ahmedsabie 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 @universeroc)


toxicity/src/index.ts line 37 at r1 (raw file):

Previously, ahmedsabie wrote…

Rephrase it to "URL to load model from. Defaults to tfhub.dev.

Sorry I should have been clearer, the argument name should still stay as modelURL, so the whole line should be:

* @param modelURL. URL to load model from. Defaults to tfhub.dev.

Remove the duplicate Defaults to tfhub.dev on the next line as well.


toxicity/src/index.ts line 41 at r2 (raw file):

 */
export async function load(threshold: number, toxicityLabels: string[],
    URL: 'https://tfhub.dev/tensorflow/tfjs-model/toxicity/1/default/1') {

rename argument back to modelURL

@universeroc universeroc force-pushed the master branch 2 times, most recently from 5b34adf to 6e1d658 Compare October 8, 2022 02:15
@universeroc
Copy link
Author

universeroc commented Oct 8, 2022

@ahmedsabie setModelURL should not be set private as in function load call this setModelURL There's no friend keyword like C++ so I remove the private keyword in this commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants