Skip to content

Commit

Permalink
Move model_type and max_steps to build_options
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Sep 22, 2023
1 parent 2d25a42 commit e7a9711
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/SIL.Machine.AspNetCore/Services/ClearMLService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace SIL.Machine.AspNetCore.Services;
using Newtonsoft.Json.Linq;

namespace SIL.Machine.AspNetCore.Services;

public class ClearMLService : IClearMLService
{
Expand Down Expand Up @@ -87,18 +89,22 @@ public async Task<string> CreateTaskAsync(
CancellationToken cancellationToken = default
)
{
if (buildOptions == "")
buildOptions = "{}";
JObject buildOptionsJson = JObject.Parse(buildOptions);
buildOptionsJson.Add("model_type", _options.CurrentValue.ModelType);
buildOptionsJson.Add("max_steps", _options.CurrentValue.MaxSteps);
buildOptions = buildOptionsJson.ToString();
string script =
"from machine.jobs.build_nmt_engine import run\n"
+ "args = {\n"
+ $" 'model_type': '{_options.CurrentValue.ModelType}',\n"
+ $" 'engine_id': '{engineId}',\n"
+ $" 'build_id': '{buildId}',\n"
+ $" 'src_lang': '{ConvertLanguageTag(sourceLanguageTag)}',\n"
+ $" 'trg_lang': '{ConvertLanguageTag(targetLanguageTag)}',\n"
+ $" 'max_steps': {_options.CurrentValue.MaxSteps},\n"
+ $" 'shared_file_uri': '{sharedFileUri}',\n"
+ $" 'clearml': True,\n"
+ $" 'build_options': '{buildOptions}'\n"
+ $" 'build_options': {buildOptions}\n"
+ "}\n"
+ "run(args)\n";

Expand Down

0 comments on commit e7a9711

Please sign in to comment.