Exemplo n.º 1
0
 public MarianCustomizer(
     MTModel model,
     MTModel customModel,
     ParallelFilePair inputPair,
     ParallelFilePair indomainValidPair,
     string customLabel,
     bool includePlaceholderTags,
     bool includeTagPairs,
     List <string> postCustomizationBatch,
     IsoLanguage sourceLanguage,
     IsoLanguage targetLanguage,
     bool guidedAlignment = false)
 {
     this.model                    = model;
     this.customModel              = customModel;
     this.modelDir                 = new DirectoryInfo(model.InstallDir);
     this.customDir                = new DirectoryInfo(this.customModel.InstallDir);
     this.customSource             = inputPair.Source;
     this.customTarget             = inputPair.Target;
     this.customLabel              = customLabel;
     this.includePlaceholderTags   = includePlaceholderTags;
     this.includeTagPairs          = includeTagPairs;
     this.inDomainValidationSource = indomainValidPair.Source;
     this.inDomainValidationTarget = indomainValidPair.Target;
     this.sourceLanguage           = sourceLanguage;
     this.targetLanguage           = targetLanguage;
     this.guidedAlignment          = guidedAlignment;
 }
Exemplo n.º 2
0
 internal void DownloadCompleted(MTModel model, object sender, AsyncCompletedEventArgs e)
 {
     model.InstallStatus = "Extracting";
     this.modelManager.ExtractModel(model.ModelPath);
     model.InstallStatus = "Installed";
     this.modelManager.GetLocalModels();
 }
Exemplo n.º 3
0
        internal Process ResumeCustomization(MTModel customModel)
        {
            this.customModel = customModel;
            var process = this.StartTraining();

            return(process);
        }
Exemplo n.º 4
0
 public TagEditView(MTModel selectedModel)
 {
     this.Model       = selectedModel;
     this.DataContext = selectedModel;
     this.Title       = String.Format(OpusCatMTEngine.Properties.Resources.Tags_EditTagsTitle, Model.Name);
     InitializeComponent();
     this.TagList.ItemsSource = selectedModel.ModelConfig.ModelTags;
 }
Exemplo n.º 5
0
 public TagEditView(MTModel selectedModel)
 {
     this.Model       = selectedModel;
     this.DataContext = selectedModel;
     this.Title       = $"Edit tags for {Model.Name}";
     InitializeComponent();
     this.TagList.ItemsSource = selectedModel.ModelConfig.ModelTags;
 }
Exemplo n.º 6
0
 public TranslateView(MTModel selectedModel)
 {
     this.Model          = selectedModel;
     this.DataContext    = selectedModel;
     this.wordsplitList  = new List <Run>();
     this.SourceLanguage = this.Model.SourceLanguages.First();
     this.TargetLanguage = this.Model.TargetLanguages.First();
     this.Title          = String.Format(OpusCatMTEngine.Properties.Resources.Translate_TranslateTitle, Model.Name);
     InitializeComponent();
 }
Exemplo n.º 7
0
        public TestView(MTModel selectedModel)
        {
            this.Model = selectedModel;
            this.Title = $"Translating with model {Model.Name}";
            InitializeComponent();
            var sourceCode = this.model.SourceLanguages.Single();
            var targetCode = this.model.TargetLanguages.Single();
            var testsets   = Directory.GetDirectories("TatoebaTestsets");
            var testsetDir = testsets.Single(
                x => x.EndsWith($"{sourceCode}-{targetCode}") || x.EndsWith($"{targetCode}-{sourceCode}"));

            this.SourceFileBox.Text = Directory.GetFiles(testsetDir, $"tatoeba.{sourceCode}.txt").Select(x => new FileInfo(x)).Single().FullName;
            this.RefFileBox.Text    = Directory.GetFiles(testsetDir, $"tatoeba.{targetCode}.txt").Select(x => new FileInfo(x)).Single().FullName;
            this.TargetFileBox.Text = this.SourceFileBox.Text.Replace(".txt", $"{this.model.Name}.txt");
        }
Exemplo n.º 8
0
        private void btnInstall_Click(object sender, RoutedEventArgs e)
        {
            foreach (object selected in this.ModelListView.SelectedItems)
            {
                MTModel selectedModel = (MTModel)selected;
                if (selectedModel.InstallStatus != "")
                {
                    continue;
                }

                selectedModel.InstallStatus = "Downloading";
                this.modelManager.DownloadModel(
                    selectedModel.ModelPath,
                    selectedModel.DownloadProgressChanged,
                    (x, y) => DownloadCompleted(selectedModel, x, y));
            }
        }
Exemplo n.º 9
0
        public CustomizationProgressView(MTModel selectedModel)
        {
            this.DataContext = this;


            this.Model = selectedModel;
            this.Title = $"Fine-tuning progress for model {Model.Name}";

            this.SeriesCollection = new SeriesCollection();

            var inDomainFiles  = Directory.GetFiles(this.Model.InstallDir, "valid*_1.score.txt").Select(x => new FileInfo(x)).OrderBy(x => x.CreationTime);
            var inDomainSeries = this.ScoresToSeries(inDomainFiles, "In-domain");

            this.SeriesCollection.Add(inDomainSeries);

            var outOfDomainFiles  = Directory.GetFiles(this.Model.InstallDir, "valid*_0.score.txt").Select(x => new FileInfo(x)).OrderBy(x => x.CreationTime);;
            var outOfDomainSeries = this.ScoresToSeries(outOfDomainFiles, "Out-of-domain");

            this.SeriesCollection.Add(outOfDomainSeries);

            InitializeComponent();
        }
Exemplo n.º 10
0
        public CustomizationProgressView(MTModel selectedModel)
        {
            this.DataContext = this;


            this.Model = selectedModel;
            this.Title = $"Fine-tuning progress for model {Model.Name}";

            this.SeriesCollection = new SeriesCollection();

            var inDomainFiles  = Directory.GetFiles(this.Model.InstallDir, "valid*_1.score.txt").Select(x => new FileInfo(x)).OrderBy(x => x.CreationTime);
            var inDomainSeries = this.ScoresToSeries(inDomainFiles, OpusCatMTEngine.Properties.Resources.Progress_InDomainSeriesName);

            this.SeriesCollection.Add(inDomainSeries);

            if (this.model.HasOODValidSet)
            {
                var outOfDomainFiles  = Directory.GetFiles(this.Model.InstallDir, "valid*_0.score.txt").Select(x => new FileInfo(x)).OrderBy(x => x.CreationTime);;
                var outOfDomainSeries = this.ScoresToSeries(outOfDomainFiles, OpusCatMTEngine.Properties.Resources.Progress_OutOfDomainSeriesName);
                this.SeriesCollection.Add(outOfDomainSeries);
            }

            InitializeComponent();
        }
Exemplo n.º 11
0
 public TranslateView(MTModel selectedModel)
 {
     this.Model = selectedModel;
     this.Title = $"Translating with model {Model.Name}";
     InitializeComponent();
 }