Introduction to PipApp
PipApp can help developers from caring about complicated machine learning pipelines, so they can focus more on writing machine learning application logic, and it allows developers to better integrate traditional programming business logic and machine learning code.
Follow the Pipcook Tools Initlization to get the PipApp ready.
Let’s start from an example:
Through the above example, first create a machine learning context through , you can understand it as a special async function, and the API provided by PipApp can only be used in the Learnable
function block.
We have created two machine learning blocks, in which both use nlp.classify
to complete a text classification task.
Unlike running Pipeline, PipApp needs to create a complete project directory, so before we start, let’s initialize a Node.js project.
$ npm init
$ npm install @pipcook/app --save
Because all APIs are in the package, you need to add the dependency.
After creating the project and completing the code, you can start to compile the project. Its main purpose is to analyze the project code and generate the corresponding Pipelines and project files.
You can see that after executing the above command, you will be prompted to configure Pipeline, click on the link to configure them, the developer needs to configure different data according to different call interfaces, for example, the first classification is to classify products, then we when configuring Pipeline, we must prepare dataset related to product classification.
When the configuration is complete, save the Pipeline, and you can start training (note that here you must use the training entry of the command line tool to take effect).
$ pipcook app train /path/to/your/project/script.ts
When all models are trained, you can start building the final application package:
$ pipcook app build /path/to/your/project/script.ts
After the build is completed, the {filename}.ml.js
will be generated in the directory and run using Node.js.
Because PipApp is still an experimental feature, there are few open APIs. Currently, it only provides: text classification and image classification for everyone to try, and there are some restrictions:
Only use createLearnable()
in root scope, for example:
Reference calls to modules are not supported, such as:
const foo = createLearnable((s: string) => {
const nlp2 = nlp;
nlp2.classify(s);