From 261dde1ae20a1c4f5f200696ba3b41ed1912b0ad Mon Sep 17 00:00:00 2001 From: John Lambert Date: Fri, 11 Oct 2024 10:24:13 -0400 Subject: [PATCH] Revert "Put "TrainOnAll" and "PretranslateAll" back in" This reverts commit 70a828231699629284322f0d8093d9b781318208. --- src/Echo/src/EchoTranslationEngine/Program.cs | 3 +++ .../src/Serval.Machine.EngineServer/Program.cs | 2 ++ .../Services/ServalTranslationEngineServiceV1.cs | 13 +------------ .../Protos/serval/translation/v1/engine.proto | 2 -- .../Serval.Translation/Services/EngineService.cs | 14 ++------------ 5 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/Echo/src/EchoTranslationEngine/Program.cs b/src/Echo/src/EchoTranslationEngine/Program.cs index a679dfb5..6c6f3768 100644 --- a/src/Echo/src/EchoTranslationEngine/Program.cs +++ b/src/Echo/src/EchoTranslationEngine/Program.cs @@ -17,6 +17,9 @@ WebApplication app = builder.Build(); +// Configure the HTTP request pipeline. +app.UseHttpsRedirection(); + app.MapGrpcService(); app.MapGrpcService(); diff --git a/src/Machine/src/Serval.Machine.EngineServer/Program.cs b/src/Machine/src/Serval.Machine.EngineServer/Program.cs index b03f6575..e36db6c2 100644 --- a/src/Machine/src/Serval.Machine.EngineServer/Program.cs +++ b/src/Machine/src/Serval.Machine.EngineServer/Program.cs @@ -35,6 +35,8 @@ var app = builder.Build(); +app.UseHttpsRedirection(); + app.MapServalTranslationEngineService(); app.MapHangfireDashboard(); diff --git a/src/Machine/src/Serval.Machine.Shared/Services/ServalTranslationEngineServiceV1.cs b/src/Machine/src/Serval.Machine.Shared/Services/ServalTranslationEngineServiceV1.cs index 83369376..bced613b 100644 --- a/src/Machine/src/Serval.Machine.Shared/Services/ServalTranslationEngineServiceV1.cs +++ b/src/Machine/src/Serval.Machine.Shared/Services/ServalTranslationEngineServiceV1.cs @@ -295,7 +295,7 @@ private static Models.MonolingualCorpus Map(Translation.V1.MonolingualCorpus sou var pretranslateTextIds = source.PretranslateTextIds.ToHashSet(); FilterChoice pretranslateFilter = GetFilterChoice(pretranslateChapters, pretranslateTextIds); - var corpus = new Models.MonolingualCorpus + return new Models.MonolingualCorpus { Id = source.Id, Language = source.Language, @@ -305,17 +305,6 @@ private static Models.MonolingualCorpus Map(Translation.V1.MonolingualCorpus sou PretranslateChapters = pretranslateFilter == FilterChoice.Chapters ? pretranslateChapters : null, PretranslateTextIds = pretranslateFilter == FilterChoice.TextIds ? pretranslateTextIds : null }; - if (source.PretranslateAll) - { - corpus.PretranslateChapters = null; - corpus.PretranslateTextIds = null; - } - if (source.TrainOnAll) - { - corpus.TrainOnChapters = null; - corpus.TrainOnTextIds = null; - } - return corpus; } private static Models.CorpusFile Map(Translation.V1.CorpusFile source) diff --git a/src/Serval/src/Serval.Grpc/Protos/serval/translation/v1/engine.proto b/src/Serval/src/Serval.Grpc/Protos/serval/translation/v1/engine.proto index 609a3fc0..98918f0c 100644 --- a/src/Serval/src/Serval.Grpc/Protos/serval/translation/v1/engine.proto +++ b/src/Serval/src/Serval.Grpc/Protos/serval/translation/v1/engine.proto @@ -161,8 +161,6 @@ message ParallelCorpus { message MonolingualCorpus { string id = 1; string language = 2; - bool train_on_all = 3; - bool pretranslate_all = 4; map train_on_chapters = 5; map pretranslate_chapters = 6; repeated string train_on_text_ids = 7; diff --git a/src/Serval/src/Serval.Translation/Services/EngineService.cs b/src/Serval/src/Serval.Translation/Services/EngineService.cs index 6c8c3059..47c4ab9b 100644 --- a/src/Serval/src/Serval.Translation/Services/EngineService.cs +++ b/src/Serval/src/Serval.Translation/Services/EngineService.cs @@ -601,12 +601,7 @@ private V1.ParallelCorpus Map(Corpus source, TrainingCorpus? trainingCorpus, Pre V1.MonolingualCorpus targetCorpus = new() { Language = source.TargetLanguage, Files = { source.TargetFiles.Select(Map) } }; - if (trainingCorpus == null) - { - sourceCorpus.TrainOnAll = true; - targetCorpus.TrainOnAll = true; - } - else + if (trainingCorpus != null) { if (trainingCorpus.TextIds is not null && trainingCorpus.ScriptureRange is not null) { @@ -641,12 +636,7 @@ private V1.ParallelCorpus Map(Corpus source, TrainingCorpus? trainingCorpus, Pre targetCorpus.TrainOnChapters.Add(chapters); } } - if (pretranslateCorpus == null) - { - sourceCorpus.PretranslateAll = true; - targetCorpus.PretranslateAll = true; - } - else + if (pretranslateCorpus != null) { if (pretranslateCorpus.TextIds is not null && pretranslateCorpus.ScriptureRange is not null) {