-
Notifications
You must be signed in to change notification settings - Fork 208
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
Optimize the time cost to go into training #410
Conversation
… into add/global-process
…data-process-pipeline
@@ -40,6 +42,11 @@ class DataLoader implements ImageDataLoader { | |||
label: this.dataPairs[id].label | |||
}; | |||
} | |||
|
|||
async setItem(id: number, sample: ImageSample) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async setItem(id: number, sample: ImageSample) { | |
setItem(id: number, sample: ImageSample): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is extended from super-class async function. Acutally return value is Promise. I give it as async function since it's likely that in some cases we need to do some async logic inside setItem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the return value is void, we need to use : Promise<void>
.
The second part is the return type. We make it clear which is the return type by using an arrow (=>) between the parameters and the return type. As mentioned before, this is a required part of the function type, so if the function doesn’t return a value, you would use void instead of leaving it off.
https://www.typescriptlang.org/docs/handbook/functions.html#writing-the-function-type
@@ -32,6 +33,10 @@ class DataLoader implements CsvDataLoader { | |||
async getItem(id: number) { | |||
return this.records[id]; | |||
} | |||
|
|||
async setItem(id: number, sample: CsvSample) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async setItem(id: number, sample: CsvSample) { | |
setItem(id: number, sample: CsvSample): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
packages/plugins/model-train/image-classification-tfjs-model-train/src/index.ts
Outdated
Show resolved
Hide resolved
getItem: (id: number) => Promise<Sample>; | ||
next?: () => Promise<Sample>; | ||
nextBatch?: (batchSize: number) => Promise<Array<Sample>>; | ||
export abstract class DataLoader{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export abstract class DataLoader{ | |
export abstract class DataLoader { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And a unit tests for this class is required :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint problem has been fixed. I will add a unit test ASAP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit test has been added. Please have a check pls :)
packages/costa/src/client/entry.ts
Outdated
return; | ||
} | ||
|
||
if (pkg.pipcook.category === 'datasetProcess') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we move the datasetProcess
to default handler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, have remove this
@rickycao-qy @WenheLI Awesome works and reviewed some small nits, BTW there might be a little bit conflicts with #405, @FeelyChau how can we merge them? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if CI is green
packages/plugins/data-process/tfjs-image-classification-process/tsconfig.json
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if CI passed.
This PR changes as following:
Now the plugin of data-process, tfjs-simplecnn, tjfs-train has been changed using this new way to train. The test pipeline is test/pieplines/mnist-image-classification.json
Baseline:
the baseline test pipeline is in this pr branch's test/pipelines/mnist-image-classification
The CPU used is 2.2 GHz Quad-Core Intel Core i7