Skip to content

Method not found: 'Void Module.train()'. #666

@drGarbinsky

Description

@drGarbinsky

I'm currently trying to get the same running from this page: https://devblogs.microsoft.com/dotnet/introducing-the-ml-dotnet-text-classification-api-preview/
working with:
dotnet: 7.0.100-preview.6.22352.1
Microsoft.ML Version="2.0.0-preview.22313.1"
Microsoft.ML.TorchSharp Version="0.20.0-preview.22313.1"
TorchSharp-cpu Version="0.97.0"

WSL ubuntu: 20.04.3 LTS

code:

using Microsoft.ML;
using Microsoft.ML.TorchSharp;

// Initialize MLContext
var mlContext = new MLContext();

// Load your data
var reviews = new[]
{
new {Text = "This is a bad steak", Sentiment = "Negative"},
new {Text = "I really like this restaurant", Sentiment = "Positive"}
};

var reviewsDV = mlContext.Data.LoadFromEnumerable(reviews);

//Define your training pipeline
var pipeline =
mlContext.Transforms.Conversion.MapValueToKey("Label", "Sentiment")
.Append(mlContext.MulticlassClassification.Trainers.TextClassification(numberOfClasses: 2, sentence1ColumnName: "Text"))
.Append(mlContext.Transforms.Conversion.MapKeyToValue("PredictedLabel"));

// Train the model
var model = pipeline.Fit(reviewsDV);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions