public static TransposeLoader Create(IHostEnvironment env, ModelLoadContext ctx, IMultiStreamSource files)
        {
            Contracts.CheckValue(env, nameof(env));
            IHost h = env.Register(LoadName);

            h.CheckValue(ctx, nameof(ctx));
            ctx.CheckAtModel(GetVersionInfo());
            h.CheckValue(files, nameof(files));

            return(h.Apply("Loading Model",
                           ch =>
            {
                if (files.Count == 0)
                {
                    BinaryLoader schemaView = null;
                    // In the case where we have no input streams, but we have an input schema from
                    // the model repository, we still want to surface ourselves as being a binary loader
                    // with the existing schema. The loader "owns" this stream.
                    if (ctx.TryLoadBinaryStream("Schema.idv",
                                                r => schemaView = new BinaryLoader(h, new BinaryLoader.Arguments(),
                                                                                   HybridMemoryStream.CreateCache(r.BaseStream), leaveOpen: false)))
                    {
                        h.AssertValue(schemaView);
                        h.CheckDecode(schemaView.GetRowCount() == 0);
                        // REVIEW: Do we want to be a bit more restrictive around uninterpretable columns?
                        return new TransposeLoader(h, ctx, schemaView);
                    }
                    h.Assert(schemaView == null);
                    // Fall through, allow the failure to be on OpenStream.
                }
                return new TransposeLoader(h, ctx, files);
            }));
        }
Exemple #2
0
        public static ParquetPartitionedPathParser Create(IHostEnvironment env, ModelLoadContext ctx)
        {
            Contracts.CheckValue(ctx, nameof(ctx));
            IHost host = env.Register(LoadName);

            ctx.CheckAtModel(GetVersionInfo());

            return(host.Apply("Loading Parser",
                              ch => new ParquetPartitionedPathParser(host, ctx)));
        }
        internal static DatabaseLoader Create(IHostEnvironment env, ModelLoadContext ctx)
        {
            Contracts.CheckValue(env, nameof(env));
            IHost h = env.Register(RegistrationName);

            h.CheckValue(ctx, nameof(ctx));
            ctx.CheckAtModel(GetVersionInfo());

            return(h.Apply("Loading Model", ch => new DatabaseLoader(h, ctx)));
        }
        private static CompositeDataLoader <TSource, TLastTransformer> Create(IHostEnvironment env, ModelLoadContext ctx)
        {
            Contracts.CheckValue(env, nameof(env));
            IHost h = env.Register(LoaderSignature);

            h.CheckValue(ctx, nameof(ctx));
            ctx.CheckAtModel(GetVersionInfo());

            return(h.Apply("Loading Model", ch => new CompositeDataLoader <TSource, TLastTransformer>(h, ctx)));
        }
        public static WordEmbeddingsTransform Create(IHostEnvironment env, ModelLoadContext ctx, IDataView input)
        {
            Contracts.CheckValue(env, nameof(env));
            IHost h = env.Register(RegistrationName);

            h.CheckValue(ctx, nameof(ctx));
            h.CheckValue(input, nameof(input));
            return(h.Apply("Loading Model",
                           ch => new WordEmbeddingsTransform(h, ctx, input)));
        }
Exemple #6
0
        public static LabelIndicatorTransform Create(IHostEnvironment env,
                                                     Arguments args, IDataView input)
        {
            Contracts.CheckValue(env, nameof(env));
            IHost h = env.Register(LoaderSignature);

            h.CheckValue(args, nameof(args));
            h.CheckValue(input, nameof(input));
            return(h.Apply("Loading Model",
                           ch => new LabelIndicatorTransform(h, args, input)));
        }
        public static ParquetLoader Create(IHostEnvironment env, ModelLoadContext ctx, IMultiStreamSource files)
        {
            Contracts.CheckValue(env, nameof(env));
            IHost host = env.Register(LoaderName);

            env.CheckValue(ctx, nameof(ctx));
            ctx.CheckAtModel(GetVersionInfo());
            env.CheckValue(files, nameof(files));

            return(host.Apply("Loading Model",
                              ch => new ParquetLoader(host, ctx, files)));
        }
        public static ParquetLoader Create(IHostEnvironment env, ModelLoadContext ctx, IMultiStreamSource files)
        {
            Contracts.CheckValue(env, nameof(env));
            IHost host = env.Register(LoaderName);

            env.CheckValue(ctx, nameof(ctx));
            ctx.CheckAtModel(GetVersionInfo());
            env.CheckValue(files, nameof(files));

            // *** Binary format ***
            // int: cached chunk size
            // bool: TreatBigIntegersAsDates flag

            Arguments args = new Arguments
            {
                ColumnChunkReadSize     = ctx.Reader.ReadInt32(),
                TreatBigIntegersAsDates = ctx.Reader.ReadBoolean()
            };

            return(host.Apply("Loading Model",
                              ch => new ParquetLoader(args, host, OpenStream(files))));
        }