Skip to content

Add new type to key-value converter #6973

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

Merged
merged 8 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add dataview support in source generator
  • Loading branch information
LittleLittleCloud committed Jan 24, 2024
commit 11e90bc703151a8fa500e059ce65717cc7f0a67e
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"name": "AddKeyValueAnnotationsAsText",
"type": "boolean",
"default": false
},
{
"name": "KeyData",
"type": "dataView"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ internal partial class MapValueToKey
{
public override IEstimator<ITransformer> BuildFromOption(MLContext context, MapValueToKeyOption param)
{
return context.Transforms.Conversion.MapValueToKey(param.OutputColumnName, param.InputColumnName, addKeyValueAnnotationsAsText: param.AddKeyValueAnnotationsAsText);
return context.Transforms.Conversion.MapValueToKey(param.OutputColumnName, param.InputColumnName, addKeyValueAnnotationsAsText: param.AddKeyValueAnnotationsAsText, keyData: param.KeyData);
}
}

internal partial class MapKeyToValue
{
public override IEstimator<ITransformer> BuildFromOption(MLContext context, MapKeyToValueOption param)
{
return context.Transforms.Conversion.MapKeyToValue(param.OutputColumnName, param.InputColumnName, param.KeyData);
return context.Transforms.Conversion.MapKeyToValue(param.OutputColumnName, param.InputColumnName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void Execute(GeneratorExecutionContext context)
"bertArchitecture" => "BertArchitecture",
"imageClassificationArchType" => "Microsoft.ML.Vision.ImageClassificationTrainer.Architecture",
"dataKind" => "Microsoft.ML.Data.DataKind",
"dataView" => "Microsoft.ML.IDataView",
_ => throw new ArgumentException("unknown type"),
};

Expand All @@ -76,6 +77,7 @@ public void Execute(GeneratorExecutionContext context)
(_, "BertArchitecture") => defaultToken.GetValue<string>(),
(_, "Microsoft.ML.Vision.ImageClassificationTrainer.Architecture") => defaultToken.GetValue<string>(),
(_, "Microsoft.ML.Data.DataKind") => defaultToken.GetValue<string>(),
(_, "Microsoft.ML.IDataView") => defaultToken.GetValue<string>(),
(_, _) => throw new ArgumentException("unknown"),
};

Expand Down