Skip to main content
Lucidworks Search uses Seldon Core to deploy machine learning (ML) models into production.
In Fusion 5.9.12 and later, Ray replaces Seldon for model hosting. Models previously provided as Seldon deployments are not deployable to Ray without changes. You can redeploy the same underlying model on Ray by building a ray[serve] compatible Docker image and using Create Ray Model Deployment, but do not reuse the Seldon deployment image or endpoint.
This job deploys a Seldon Core deployment into the Lucidworks Search cluster. To create the job, sign in to Lucidworks Search and click Collections > Jobs. Then click Add+ and in the Model Deployment Jobs section, select Create Seldon Core Model Deployment. You can enter basic and advanced parameters to configure the job. If the field has a default value, it is populated when you click to add the job. To enter advanced parameters in the UI, click Advanced. For detailed information to deploy available Lucidworks Search Seldon models, see the:
  • sentiment-general model. This model is a general purpose sentiment prediction model that is trained on short sentences and text for intent prediction. For more information, see Sentiment analysis and prediction.
  • sentiment-reviews model. This model is trained on customer reviews and longer text. The model also supports attention weights output that can be used for highlighting the tokens that provide stronger sentiment. For more information, see Sentiment analysis and prediction.
  • pre-trained scispaCy model. This model is trained on biomedical text.
  • qna-coldstart-large model. This model is trained on a variety of corpuses and tasks. For more information, see Smart answers.
  • qna-coldstart-multilingual model. This model is trained on a variety of corpuses and tasks that supports 16 languages. For more information, see Smart answers.
This topic explains how to deploy the sentiment-general pre-trained sentiment prediction model. This is a general-purpose sentiment prediction model, trained on short sentences. It is suitable for short texts and for intent prediction.
  1. Navigate to Collections > Jobs.
  2. Select New > Create Seldon Core Model Deployment.
  3. Configure the job as follows:
    • Job ID. The ID for this job, such as deploy-sentiment-general.
    • Model Name. The model name of the Seldon Core deployment that will be referenced in the Machine Learning pipeline stage configurations, such as sentiment-general.
    • Docker Repository. The value is lucidworks.
    • Image Name. The value is sentiment-general:v1.0.
    • Kubernetes Secret Name for Model Repo. This value is left empty.
    • Output Column Names for Model. The value is [label, score].
  4. Click Save.
  5. Click Run > Start.

Configure the Machine Learning pipeline stages

In your index or query pipelines add Machine Learning stage and specify sentiment-general in the Model ID field (or a custom model name that was used during deployment).

Configure the Machine Learning index stage

  1. In your index pipeline, click Add a Stage > Machine Learning.
  2. In the Model ID field, enter the model name you configured above, such as sentiment-general.
  3. In the Model input transformation script field, enter the following:
  4. In the Model output transformation script field, enter the following:
  5. Save the pipeline.

Configure the Machine Learning query stage

  1. In your query pipeline, click Add a Stage > Machine Learning.
  2. In the Model ID field, enter the model name you configured above, such as sentiment-general.
  3. In the Model input transformation script field, enter the following:
  4. In the Model output transformation script field, enter the following:
  5. Save the pipeline.

Model output

Both of the pre-trained models output the following:
  • a label, negative or positive
  • a score from -2 to 2
The sentiment-reviews:v1.0 model also optionally outputs tokens and their corresponding attention weights, that is, the weight that each token carries in the sentiment prediction. The total of all attention weights is always 1, that is, each value represents a percentage of the total weight. In the example below, “awesome” has the highest weight because it expresses the strongest sentiment compared to other tokens in the string:
This topic explains how to deploy the sentiment-reviews pre-trained sentiment prediction model. This model is trained on a variety of customer reviews and optimized for longer texts. It also supports attention weights output that can be used for highlighting the tokens that provide stronger sentiment; see Model output below for an example.

Install the model in Lucidworks Search

  1. Navigate to Collections > Jobs.
  2. Select New > Create Seldon Core Model Deployment.
  3. Configure the job as follows:
    • Job ID. The ID for this job, such as deploy-sentiment-reviews
    • Model Name. The model name of the Seldon Core deployment that will be referenced in the Machine Learning pipeline stage configurations, such as sentiment-reviews.
    • Docker Repository. The value is lucidworks.
    • Image Name. The value is sentiment-reviews:v1.0.
    • Kubernetes Secret Name for Model Repo. The value is left empty.
    • Output Column Names for Model. The value is [label, score, tokens, attention_weights].
  4. Click Save.
  5. Click Run > Start.

Configure the Machine Learning pipeline stages

You can put your sentiment prediction model to work using the Machine Learning index stage or Machine Learning query stage. You will specify the same Model Name that you used when you installed the model above.Generally, you only need to apply the model in the index pipeline to perform sentiment prediction on your content. Optionally, you can configure the query pipeline in a similar way, to perform sentiment prediction on incoming queries and outgoing responses and apply special treatment depending on the prediction.

Configure the Machine Learning index stage

  1. In your index pipeline, click Add a Stage > Machine Learning.
  2. In the Model ID field, enter the model name you configured above, such as sentiment-reviews.
  3. In the Model input transformation script field, enter one of the following, depending on whether you want to output attention weights:
    Without attention weights:
    With attention weights:
  4. In the Model output transformation script field, enter the following:
    Without attention weights:
    With attention weights:
  5. Save the pipeline.

Optional: Configure the Machine Learning query stage

  1. In your query pipeline, click Add a Stage > Machine Learning.
  2. In the Model ID field, enter the model name you configured above, such as sentiment-reviews.
  3. In the Model input transformation script field, enter the following:
    Without attention weights:
    With attention weights:
  4. In the Model output transformation script field, enter the following, noting the sections that need to be uncommented if you are using attention weights:
  5. Save the pipeline.

Model output

Both of the pre-trained models output the following:
  • a label, negative or positive
  • a score from -2 to 2
The sentiment-reviews:v1.0 model also optionally outputs tokens and their corresponding attention weights, that is, the weight that each token carries in the sentiment prediction. The total of all attention weights is always 1, that is, each value represents a percentage of the total weight. In the example below, “awesome” has the highest weight because it expresses the strongest sentiment compared to other tokens in the string:
This article uses a pre-packaged model, which you do not need to download to deploy. To use the pre-packaged model, skip to Deploy model to Fusion. The section Create the model describes how to complete this process on your own.

Create the model (OPTIONAL)

Skip this section to use the pre-packaged model.
  1. Copy the scispacy.ipynb file below and open it in Jupyter Notebook (or a similar alternative):
  2. Follow the steps in the notebook, substituting your custom values as needed.

Deploy model to Fusion

  1. Navigate to Collections > Jobs.
  2. Click the Add button.
  3. Select the Create Seldon Core Model Deployment under Model Deployment Jobs. Add Model Deployment job
  4. Enter the values for your model deployment. If you are using the pre-packaged model, use the following values: Seldon Core job config
  5. Run the job by clicking Run and selecting Start.
When the job completes successfully, the model is deployed. Check the list of microservices to verify:Fusion microservices

Import sample data

  1. Download and save the sample data file sampleJSON_body_content.csv.
  2. Navigate to Indexing > Datasources.
  3. Click the Add button and select File Upload V2. Add File Upload job
  4. Click Browse, select the sampleJSON_body_content.csv file, and click Open. Click the Upload File button to complete the upload process.
  5. Assign a value to the Datasource ID parameter. This article uses the ID sample-data. Datasource config
  6. Click the Save button.

Create a Machine Learning stage in the Index Workbench

  1. Navigate to Indexing > Index Workbench.
  2. Click the Load button.
  3. Choose the datasource you created.
  4. Click the Add a Stage button.
  5. Choose the Machine Learning stage.
  6. In the Model ID field, enter scispacymodel.
  7. In the Model input transformation script field, enter the following script:
  8. In the Model output transformation script field, enter the following script:
  9. Click the Apply button.

Verify results

  1. Click the Start Job button, and allow the job to finish. Index Workbench start job
  2. Check the simulated results. If everything was successful, the results will resemble this: Index workbench result
Lucidworks provides these pre-trained cold start models for Smart Answers:
  • qna-coldstart-large - this is a large model trained on variety of corpuses and tasks.
  • qna-coldstart-multilingual - covers 16 languages. List of supported languages: Arabic, Chinese-simplified, Chinese-traditional, English, French, German, Italian, Japanese, Korean, Dutch, Polish, Portuguese, Spanish, Thai, Turkish, Russian.
When you use these models, you do not need to run the model training job. Instead, you run a job that deploys the model into Lucidworks Search. The Create Seldon Core Model Deployment job deploys your model as a Docker image in Kubernetes, which you can scale up or down like other Lucidworks Search services.These models are a good basis for a cold start solution if your data does not contain much domain-specific terminology. Otherwise, consider training a model using your existing content.
Dimension size of vectors for both models is 512. You might need this information when creating collections in Milvus.
The pre-trained cold-start models are deployed using a Lucidworks Search job called Create Seldon Core Model Deployment. This job downloads the selected pre-trained model and installs it in Lucidworks Search.
  1. Navigate to Collections > Jobs.
  2. Select Add > Create Seldon Core Model Deployment.
  3. Enter a Job ID, such as deploy-qna-coldstart-multilingual or deploy-qna-coldstart-large.
  4. Enter the Model Name, one of the following:
    • qna-coldstart-multilingual
    • qna-coldstart-large
  5. In the Docker Repository field, enter lucidworks.
  6. In the Image Name field, enter one of the following:
    • qna-coldstart-multilingual:v1.1
    • qna-coldstart-large:v1.1
  7. Leave the Kubernetes Secret Name for Model Repo field empty.
  8. In the Output Column Names for Model field, enter one of the following:
    • qna-coldstart-multilingual:[vector]
    • qna-coldstart-large:[vector, compressed_vector]
  9. Click Save.
  10. Click Run > Start to start the deployment job.

Next steps

  1. Evaluate a Smart Answers Query Pipeline

Configuration properties