示例#1
0
文件: run_demo.py 项目: stsaten6/lrn2
def main():
    parser = argparse.ArgumentParser(
        description="Run a lrn2 custom layer example. "
        "In this case, the custom layer is a transformation "
        "layer, and the resulting stack can be seen "
        "as a single capsule of a transforming auto-encoder "
        "(see Hinton et. al. 2011).")

    parser.add_argument("run_keyword",
                        metavar="run_keyword",
                        help="Keyword for the current test")

    parser.add_argument("modelconfig",
                        help="model config file (stack, higher level)")

    parser.add_argument(
        "traindata",
        help=("text file listing tab separated "
              "(midifile, label) pairs (one per line), "
              "TXT files expected. For this example, "
              "use monophonic MIDIs (e.g. Essen Folksong Collection "
              "http://www.esac-data.org/). To create a "
              "file list, use lrn2/util/create_filelist.py."))

    parser.add_argument("-d", default=".", help=("midi folder"))

    parser.add_argument(
        "--re-train",
        action="store_true",
        default=False,
        help=
        "ignores stored training files corresponding to the run_keyword used")

    parser.add_argument(
        "--no-training",
        action="store_true",
        default=False,
        help="loads stored parameters, no further training takes place")

    parser.add_argument("--load-existing",
                        action="store_true",
                        default=False,
                        help="loads existing parameters, trains non-existing")

    parser.add_argument(
        "--rebuild-corpus",
        action="store_true",
        default=False,
        help=
        "reloads data and rebuilds temporary files for accelerating data import"
    )

    args = parser.parse_args()

    config = get_config(args.modelconfig)

    test_custom(args, config)
示例#2
0
文件: run_demo.py 项目: gray0302/lrn2
def main():
    parser = argparse.ArgumentParser(description = "Run a complete lrn2 work flow")

    parser.add_argument("run_keyword", metavar = "run_keyword", help = "Keyword for the current test")

    parser.add_argument("modelconfig", help = "model config file")

    parser.add_argument("--re-train", action = "store_true", default = False,
                        help = "re-trains RBM, ignoring cached files corresponding to the run_keyword used")
    
    parser.add_argument("--load-existing", action = "store_true", default = False,
                       help = "loads existing parameters, trains non-existing")
    
    parser.add_argument("--rebuild-corpus", action = "store_true", default = False,
                        help = "reloads data and rebuilds temporary files for accelerating data import")

    args = parser.parse_args()

    config = get_config(args.modelconfig)

    test_mnist(args, config)
示例#3
0
def change_param(config_file, command):

    config = get_config(config_file)
    exec command
    config.write()