Skip to content
Snippets Groups Projects
Commit 52cc4557 authored by Christos Christodoulopoulos's avatar Christos Christodoulopoulos
Browse files

Added ILP Solver as a property

Added more pipeline properties
Squashed "weight vector loaded" message
parent e2ce6a50
No related branches found
No related tags found
1 merge request!11Windows support (+ minor refactoring)
Pipeline #
# Flags for whether to use different annotators
## Flags for whether to use different annotators
usePos = true
useLemma = true
useShallowParse = true
......@@ -7,4 +7,11 @@ useNerOntonotes = false
useStanfordParse = true
useStanfordDep = true
useSrlVerb = false
useSrlNom = false
\ No newline at end of file
useSrlNom = false
## Flags for the Stanford parser (for pre-processing)
# Max time per sentence (in milliseconds)
stanfordMaxTimePerSentence = 1000
# Max sentence lenght (will throw exception if larger)
stanfordParseMaxSentenceLength = 80
\ No newline at end of file
#############################################
##
## Illinois SRL Configuration
##
#############################################
## Illinois SRL Configuration##
# Whether to use the Illinois Curator to get the required annotations for training/testing
# If set to false, Illinois NLP pipeline will be used
......@@ -22,6 +18,10 @@ LearnerConfig = config/learner.properties
# Num of threads for feat. ext.
NumFeatExtThreads = 10
# The ILP solver to use for the joint inference
# Options are: Gurobi, OJAlgo
ILPSolver = OJAlgo
### Training corpora directories ###
# This is the directory of the merged (mrg) WSJ files
PennTreebankHome = /shared/corpora/corporaWeb/treebanks/eng/pennTreebank/treebank-3/parsed/mrg/wsj/
......
......@@ -459,7 +459,7 @@ public class Main {
Dataset testSet = Dataset.PTBTest;
ILPSolverFactory solver = new ILPSolverFactory(ILPSolverFactory.SolverType.JLISCuttingPlaneGurobi);
ILPSolverFactory solver = new ILPSolverFactory(properties.getILPSolverType(true));
String outDir = properties.getOutputDir();
PrintWriter goldWriter = null, predWriter = null;
......
package edu.illinois.cs.cogcomp.srl;
import edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager;
import edu.illinois.cs.cogcomp.infer.ilp.ILPSolverFactory;
import edu.illinois.cs.cogcomp.srl.config.SrlConfigurator;
import edu.illinois.cs.cogcomp.srl.core.Models;
import edu.illinois.cs.cogcomp.srl.core.SRLType;
......@@ -17,7 +18,6 @@ public class SRLProperties {
private static SRLProperties theInstance;
private ResourceManager config;
/**
* configFile must have all parameters set, ideally using the SrlConfigurator class.
* @param configFile file with configuration parameters
......@@ -175,4 +175,19 @@ public class SRLProperties {
public String getPipelineConfig() {
return this.config.getString("PipelineConfig");
}
public ILPSolverFactory.SolverType getILPSolverType(boolean isEvaluating) {
String solver = config.getString("ILPSolver");
switch (solver) {
case "Gurobi":
if (isEvaluating)
return ILPSolverFactory.SolverType.JLISCuttingPlaneGurobi;
else return ILPSolverFactory.SolverType.Gurobi;
case "OJAlgo":
return ILPSolverFactory.SolverType.OJAlgo;
default:
log.info("Using default ILP Solver: OJAlgo");
return ILPSolverFactory.SolverType.OJAlgo;
}
}
}
......@@ -9,7 +9,6 @@ import edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation
import edu.illinois.cs.cogcomp.core.datastructures.textannotation.View;
import edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager;
import edu.illinois.cs.cogcomp.infer.ilp.ILPSolverFactory;
import edu.illinois.cs.cogcomp.infer.ilp.ILPSolverFactory.SolverType;
import edu.illinois.cs.cogcomp.srl.config.SrlConfigurator;
import edu.illinois.cs.cogcomp.srl.core.Models;
import edu.illinois.cs.cogcomp.srl.core.SRLManager;
......@@ -53,8 +52,7 @@ public class SemanticRoleLabeler extends Annotator {
else {
for (SRLType type : SRLType.values()) {
srlType = type.name();
srlLabelers
.add(new SemanticRoleLabeler(rm, srlType, true));
srlLabelers.add(new SemanticRoleLabeler(rm, srlType, true));
}
}
} catch (Exception e) {
......@@ -81,7 +79,8 @@ public class SemanticRoleLabeler extends Annotator {
}
for (SemanticRoleLabeler srl : srlLabelers) {
System.out.println(srl.getSRLCuratorName());
if (srlLabelers.size() > 1)
System.out.println(srl.getViewName());
PredicateArgumentView p;
try {
......@@ -104,7 +103,6 @@ public class SemanticRoleLabeler extends Annotator {
}
public SemanticRoleLabeler(ResourceManager rm, String srlType) throws Exception {
this(rm, srlType, false);
}
......@@ -167,13 +165,7 @@ public class SemanticRoleLabeler extends Annotator {
if (predicates.isEmpty())
return null;
ILPSolverFactory s = new ILPSolverFactory(SolverType.Gurobi);
try {
s.getSolver();
}
catch (UnsatisfiedLinkError e) {
s = new ILPSolverFactory(SolverType.OJAlgo);
}
ILPSolverFactory s = new ILPSolverFactory(properties.getILPSolverType(false));
SRLILPInference inference = new SRLILPInference(s, manager, predicates);
return inference.getOutputView();
......@@ -187,7 +179,6 @@ public class SemanticRoleLabeler extends Annotator {
throw new AnnotatorException("Missing required view: " + view);
}
}
try {
View srlView = getSRL(ta);
ta.addView( getViewName(), srlView);
......
......@@ -56,7 +56,7 @@ public class ModelInfo {
public void loadWeightVector() {
if (w != null) {
log.info("Weight vector already loaded!");
log.debug("Weight vector already loaded!");
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment