import sling import sling.flags as flags import sling.task.workflow as workflow flags.define("--crf", default=False, action='store_true') flags.parse() # Start up workflow system. workflow.startup() # Create workflow. wf = workflow.Workflow("bio-training") # Parser trainer inputs and outputs. kb = wf.resource( #"local/data/e/wiki/kb.sling", "data/dev/types.sling", format="store/frame") training_corpus = wf.resource("local/data/e/silver/en/[email protected]", format="record/document") evaluation_corpus = wf.resource("local/data/e/silver/en/eval.rec", format="record/document") vocabulary = wf.resource("local/data/e/silver/en/vocabulary.map", format="textmap/word") parser_model = wf.resource("local/data/e/knolex/" + ("bio" if flags.arg.crf else "crf") + "-en.flow",
# limitations under the License. """Build FactGrid knowledge base and alias tables.""" import sling import sling.flags as flags import sling.task.workflow as workflow import sling.task.data as data flags.parse() # Start up workflow system. workflow.startup() # Create workflow. wf = workflow.Workflow("factgrid") datasets = data.Datasets(wf) # Resources. def res(files, fmt="records/frame"): return wf.resource(files, format=fmt) fgdir = "data/e/factgrid" fg_items = res(fgdir + "/factgrid-items.rec") fg_properties = res(fgdir + "/factgrid-properties.rec") items = res(fgdir + "/items.rec") fanin = res(fgdir + "/fanin.rec") xrefs = res(fgdir + "/xrefs.sling", "store/frame") xref_config = res("data/factgrid/xrefs.sling", "store/frame") recon_config = res("data/factgrid/recon.sling", "store/frame") fg_kb = res(fgdir + "/factgrid-kb.sling", "store/frame")
import sling import sling.flags as flags import sling.task.workflow as workflow # Start up workflow system. flags.parse() workflow.startup() # Create workflow. wf = workflow.Workflow("parser-training") # Parser trainer inputs and outputs. training_corpus = wf.resource("local/data/corpora/caspar/train_shuffled.rec", format="record/document") evaluation_corpus = wf.resource("local/data/corpora/caspar/dev.rec", format="record/document") word_embeddings = wf.resource( "local/data/corpora/caspar/word2vec-32-embeddings.bin", format="embeddings") parser_model = wf.resource("local/data/e/caspar/caspar.flow", format="flow") # Parser trainer task. trainer = wf.task("caspar-trainer") trainer.add_params({ "learning_rate": 1.0, "learning_rate_decay": 0.8, "clipping": 1,
flags.parse() if flags.arg.accurate: modelfn = "local/data/e/caspar/caspar-accurate.flow" rnn_layers = 3 rnn_dim = 192 else: modelfn = "local/data/e/caspar/caspar.flow" rnn_layers = 1 rnn_dim = 128 # Start up workflow system. workflow.startup() # Create workflow. wf = workflow.Workflow("caspar-trainer") # Parser trainer inputs and outputs. training_corpus = wf.resource("local/data/corpora/caspar/train_shuffled.rec", format="record/document") evaluation_corpus = wf.resource("local/data/corpora/caspar/dev.rec", format="record/document") word_embeddings = wf.resource( "local/data/corpora/caspar/word2vec-32-embeddings.bin", format="embeddings") parser_model = wf.resource(modelfn, format="flow") # Parser trainer task.
decoder = "bio" elif flags.arg.bio: parser_name = "bio" decoder = "bio" elif flags.arg.biaf: parser_name = "biaf" decoder = "biaffine" else: parser_name = "caspar" decoder = "caspar" # Start up workflow system. workflow.startup() # Create workflow. wf = workflow.Workflow("conll-training") # Parser trainer inputs and outputs. kb = wf.resource("data/dev/conll.sling", format="store/frame") training_corpus = wf.resource("data/c/conll2003/train.rec", format="record/document") evaluation_corpus = wf.resource("data/c/conll2003/eval.rec", format="record/document") parser_model = wf.resource("data/e/conll/" + parser_name + ".flow", format="flow") # Parser trainer task. trainer = wf.task("parser-trainer")
import sling import sling.flags as flags import sling.task.workflow as workflow flags.parse() # Start up workflow system. workflow.startup() # Create workflow. wf = workflow.Workflow("knolex-training") # Parser trainer inputs and outputs. kb = wf.resource("data/e/kb/kb.sling", format="store/frame") training_corpus = wf.resource("data/e/silver/en/[email protected]", format="record/document") evaluation_corpus = wf.resource("data/e/silver/en/eval.rec", format="record/document") vocabulary = wf.resource("data/e/silver/en/vocabulary.map", format="textmap/word") parser_model = wf.resource("data/e/knolex/knolex-en.flow", format="flow") # Parser trainer task. trainer = wf.task("parser-trainer") trainer.add_params({ "encoder": "lexrnn",
import sling import sling.flags as flags import sling.task.workflow as workflow flags.parse() # Start up workflow system. workflow.startup() # Create workflow. wf = workflow.Workflow("biaf-training") # Parser trainer inputs and outputs. kb = wf.resource( #"data/e/kb/kb.sling", "data/dev/types.sling", format="store/frame") training_corpus = wf.resource("data/e/silver/en/[email protected]", format="record/document") evaluation_corpus = wf.resource("data/e/silver/en/eval.rec", format="record/document") vocabulary = wf.resource("data/e/silver/en/vocabulary.map", format="textmap/word") parser_model = wf.resource("data/e/knolex/biaf-en.flow", format="flow") # Parser trainer task. trainer = wf.task("parser-trainer")