예제 #1
0
        public static void Main()
        {
            using (var env = new ConsoleEnvironment())
            {
                env.ComponentCatalog.RegisterAssembly(typeof(TextLoader).Assembly);              // ML.Data
                env.ComponentCatalog.RegisterAssembly(typeof(LinearPredictor).Assembly);         // ML.StandardLearners
                env.ComponentCatalog.RegisterAssembly(typeof(CategoricalTransform).Assembly);    // ML.Transforms
                env.ComponentCatalog.RegisterAssembly(typeof(FastTreeBinaryPredictor).Assembly); // ML.FastTree
                env.ComponentCatalog.RegisterAssembly(typeof(KMeansPredictor).Assembly);         // ML.KMeansClustering
                env.ComponentCatalog.RegisterAssembly(typeof(PcaPredictor).Assembly);            // ML.PCA
                env.ComponentCatalog.RegisterAssembly(typeof(Experiment).Assembly);              // ML.Legacy
                env.ComponentCatalog.RegisterAssembly(typeof(LightGbmBinaryPredictor).Assembly);
                env.ComponentCatalog.RegisterAssembly(typeof(TensorFlowTransform).Assembly);
                env.ComponentCatalog.RegisterAssembly(typeof(ImageLoaderTransform).Assembly);
                env.ComponentCatalog.RegisterAssembly(typeof(SymSgdClassificationTrainer).Assembly);
                env.ComponentCatalog.RegisterAssembly(typeof(AutoInference).Assembly);
                env.ComponentCatalog.RegisterAssembly(typeof(SaveOnnxCommand).Assembly);
                var catalog = env.ComponentCatalog;
                var jObj    = JsonManifestUtils.BuildAllManifests(env, catalog);

                var jPath = "manifest.json";
                using (var file = File.OpenWrite(jPath))
                    using (var writer = new StreamWriter(file))
                        using (var jw = new JsonTextWriter(writer))
                        {
                            jw.Formatting = Formatting.Indented;
                            jObj.WriteTo(jw);
                        }
            }
        }
예제 #2
0
        public static void Main()
        {
            var env     = new TlcEnvironment();
            var catalog = ModuleCatalog.CreateInstance(env);
            var jObj    = JsonManifestUtils.BuildAllManifests(env, catalog);

            var jPath = "manifest.json";

            using (var file = File.OpenWrite(jPath))
                using (var writer = new StreamWriter(file))
                    using (var jw = new JsonTextWriter(writer))
                    {
                        jw.Formatting = Formatting.Indented;
                        jObj.WriteTo(jw);
                    }
        }
예제 #3
0
        private static (IEnumerable <string> epListContents, JObject manifest) BuildManifests()
        {
            ConsoleEnvironment env = new ConsoleEnvironment();

            foreach (Type type in _types)
            {
                env.ComponentCatalog.RegisterAssembly(type.Assembly);
            }

            var catalog = env.ComponentCatalog;

            var regex          = new Regex(@"\r\n?|\n", RegexOptions.Compiled);
            var epListContents = catalog.AllEntryPoints()
                                 .Select(x => string.Join("\t",
                                                          x.Name,
                                                          regex.Replace(x.Description, ""),
                                                          x.Method.DeclaringType,
                                                          x.Method.Name,
                                                          x.InputType,
                                                          x.OutputType)
                                         .Replace(Environment.NewLine, "", StringComparison.Ordinal))
                                 .OrderBy(x => x);

            var manifest = JsonManifestUtils.BuildAllManifests(env, catalog);

            //clean up the description from the new line characters
            if (manifest[FieldNames.TopEntryPoints] != null && manifest[FieldNames.TopEntryPoints] is JArray)
            {
                foreach (JToken entry in manifest[FieldNames.TopEntryPoints].Children())
                {
                    if (entry[FieldNames.Desc] != null)
                    {
                        entry[FieldNames.Desc] = regex.Replace(entry[FieldNames.Desc].ToString(), "");
                    }
                }
            }

            return(epListContents, manifest);
        }