private async Task <string> Publish(DotNetInstallation dotNetInstall, string outputDir, ITestOutputHelper output) { string tfm = DotNetSetup.GetTargetFrameworkMonikerForFrameworkVersion(dotNetInstall.FrameworkVersion); string publishDir = GetWord2VecNetPublishDirectory(dotNetInstall, outputDir, tfm); if (publishDir != null) { FileTasks.DeleteDirectory(publishDir, output); } string dotNetExePath = dotNetInstall.DotNetExe; await new ProcessRunner(dotNetExePath, $"publish -c Release -f {tfm}") .WithWorkingDirectory(GetWord2VecNetSrcDirectory(outputDir)) .WithEnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0") .WithEnvironmentVariable("WORD2VEC_FRAMEWORK_VERSION", dotNetInstall.FrameworkVersion) .WithEnvironmentVariable("UseSharedCompilation", "false") .WithLog(output) .Run(); publishDir = GetWord2VecNetPublishDirectory(dotNetInstall, outputDir, tfm); if (publishDir == null) { throw new DirectoryNotFoundException("Could not find 'publish' directory"); } return(publishDir); }
async Task DownloadAndExtractTextCorpus(DotNetInstallation dotNetInstall, string outputDir, ITestOutputHelper output) { // If the file already exists, exit string word2VecNetRepoRootDir = GetWord2VecNetRepoRootDir(outputDir); string tfm = DotNetSetup.GetTargetFrameworkMonikerForFrameworkVersion(dotNetInstall.FrameworkVersion); string word2VecNetPublishDir = GetWord2VecNetPublishDirectory(dotNetInstall, outputDir, tfm); // Download the corpus of text. This is a zip file that contains a text file of 100M of text from Wikipedia var url = "https://perfbenchmarkstorage.blob.core.windows.net/corpus/Corpus10.zip"; await FileTasks.DownloadAndUnzip(url, word2VecNetRepoRootDir + "_temp", output); FileTasks.MoveFile(Path.Combine(word2VecNetRepoRootDir + "_temp", "Corpus.txt"), Path.Combine(word2VecNetPublishDir, "Corpus.txt"), output); }
public override async Task Setup(DotNetInstallation dotNetInstall, string outputDir, bool useExistingSetup, ITestOutputHelper output) { if (!useExistingSetup) { using (var setupSection = new IndentedTestOutputHelper("Setup " + Name, output)) { await CloneWord2VecNetRepo(outputDir, setupSection); await Publish(dotNetInstall, outputDir, setupSection); await DownloadAndExtractTextCorpus(dotNetInstall, outputDir, setupSection); } } string tfm = DotNetSetup.GetTargetFrameworkMonikerForFrameworkVersion(dotNetInstall.FrameworkVersion); WorkingDirPath = GetWord2VecNetPublishDirectory(dotNetInstall, outputDir, tfm); }