Class TransformersFineTunerHpSearch
java.lang.Object
eu.sealsproject.platform.res.tool.impl.AbstractPlugin
de.uni_mannheim.informatik.dws.melt.matching_base.MatcherURL
de.uni_mannheim.informatik.dws.melt.matching_base.MatcherFile
de.uni_mannheim.informatik.dws.melt.matching_jena.MatcherYAAA
de.uni_mannheim.informatik.dws.melt.matching_jena.MatcherYAAAJena
de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersBase
de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersBaseFineTuner
de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersFineTuner
de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersFineTunerHpSearch
- All Implemented Interfaces:
Filter
,IMatcher<org.apache.jena.ontology.OntModel,
,Alignment, Properties> eu.sealsproject.platform.res.domain.omt.IOntologyMatchingToolBridge
,eu.sealsproject.platform.res.tool.api.IPlugin
,eu.sealsproject.platform.res.tool.api.IToolBridge
-
Field Summary
Modifier and TypeFieldDescriptionprivate TransformersHpSearchSpace
These are the mutations for the hyperparameter - only applicable for PBT (population based training).private TransformersHpSearchSpace
The initial hyper parameter search space.private static final org.slf4j.Logger
private int
the number of different hyperparamter combinations which are tried outprivate TransformersOptimizingMetric
The metric to optimize during hyperparameter search.private float
A number between zero and one which represents the proportion of the data to include in the test splitFields inherited from class de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersFineTuner
batchSizeOptimization
Fields inherited from class de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersBaseFineTuner
additionallySwitchSourceTarget, NEWLINE, resultingModelLocation, trainingFile
Fields inherited from class de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersBase
cudaVisibleDevices, extractor, modelName, multipleTextsToMultipleExamples, multiProcessing, trainingArguments, transformersCache, usingTensorflow
Fields inherited from class de.uni_mannheim.informatik.dws.melt.matching_base.MatcherFile
FILE_PREFIX, FILE_SUFFIX
-
Constructor Summary
ConstructorDescriptionTransformersFineTunerHpSearch
(TextExtractorMap extractor, String initialModelName, File resultingModelLocation) TransformersFineTunerHpSearch
(TextExtractor extractor, String initialModelName, File resultingModelLocation) -
Method Summary
Modifier and TypeMethodDescriptionfinetuneModel
(File trainingFile) Finetune a given model with the provided text in the csv file (three columns: first text, second text, label(0/1))Returns the mutations for the hyperparameter - only applicable for PBT (population based training).Returns the initial hyper parameter search space.int
Returns the number of trials which should be executed during hyperparameter search.Returns the metric which is optimized during hyperparameter search.float
Returns a number between zero and one which represents the proportion of the data to include in the test split.void
setHpMutations
(TransformersHpSearchSpace hpMutations) Sets the mutations for the hyperparameter - only applicable for PBT (population based training).void
setHpSpace
(TransformersHpSearchSpace hpSpace) Sets the initial hyper parameter search space.void
setNumberOfTrials
(int numberOfTrials) Sets the number of trials which should be executed during hyperparameter search.void
setOptimizingMetric
(TransformersOptimizingMetric optimizingMetric) Sets the metric which is optimized during hyperparameter search.void
setTestSize
(float testSize) Sets the number between zero and one which represents the proportion of the data to include in the test splitMethods inherited from class de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersFineTuner
addTrainingParameterToMakeTrainingFaster, getBatchSizeOptimization, getMaximumPerDeviceTrainBatchSize, getMaximumPerDeviceTrainBatchSize, isAdjustMaxBatchSize, setAdjustMaxBatchSize, setBatchSizeOptimization
Methods inherited from class de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersBaseFineTuner
clearTrainingData, createTrainingFile, finetuneModel, getResultingModelLocation, getTrainingFile, isAdditionallySwitchSourceTarget, match, setAdditionallySwitchSourceTarget, setResultingModelLocation, writeClassificationFormat, writeTrainingFile
Methods inherited from class de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersBase
addTrainingArgument, getCudaVisibleDevices, getCudaVisibleDevicesButOnlyOneGPU, getExamplesForBatchSizeOptimization, getExtractor, getExtractorMap, getModelName, getMultiProcessing, getTextualRepresentation, getTrainingArguments, getTransformersCache, isMultipleTextsToMultipleExamples, isOptimizeForMixedPrecisionTraining, isUsingTensorflow, setCudaVisibleDevices, setCudaVisibleDevices, setExtractor, setExtractorMap, setModelName, setMultipleTextsToMultipleExamples, setMultiProcessing, setOptimizeForMixedPrecisionTraining, setTrainingArguments, setTransformersCache, setUsingTensorflow, writeExamplesToFile
Methods inherited from class de.uni_mannheim.informatik.dws.melt.matching_jena.MatcherYAAAJena
getModelSpec, match, readOntology
Methods inherited from class de.uni_mannheim.informatik.dws.melt.matching_jena.MatcherYAAA
match
Methods inherited from class de.uni_mannheim.informatik.dws.melt.matching_base.MatcherFile
match
Methods inherited from class de.uni_mannheim.informatik.dws.melt.matching_base.MatcherURL
align, align, canExecute, getType
Methods inherited from class eu.sealsproject.platform.res.tool.impl.AbstractPlugin
getId, getVersion, setId, setVersion
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface eu.sealsproject.platform.res.tool.api.IPlugin
getId, getVersion
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
numberOfTrials
private int numberOfTrialsthe number of different hyperparamter combinations which are tried out -
testSize
private float testSizeA number between zero and one which represents the proportion of the data to include in the test split -
optimizingMetric
The metric to optimize during hyperparameter search. -
hpSpace
The initial hyper parameter search space. For nearly all algorithms except PBT, this is the only search space which should be defined. -
hpMutations
These are the mutations for the hyperparameter - only applicable for PBT (population based training).
-
-
Constructor Details
-
TransformersFineTunerHpSearch
public TransformersFineTunerHpSearch(TextExtractorMap extractor, String initialModelName, File resultingModelLocation) -
TransformersFineTunerHpSearch
public TransformersFineTunerHpSearch(TextExtractor extractor, String initialModelName, File resultingModelLocation)
-
-
Method Details
-
finetuneModel
Finetune a given model with the provided text in the csv file (three columns: first text, second text, label(0/1))- Overrides:
finetuneModel
in classTransformersFineTuner
- Parameters:
trainingFile
- csv file with three columns: first text, second text, label(0/1)- Returns:
- the final location (directory) of the finetuned model (which is also given in the constructor)
- Throws:
Exception
- in case of any error
-
getNumberOfTrials
public int getNumberOfTrials()Returns the number of trials which should be executed during hyperparameter search. This means how many different hyperparameter combinations should be tried out. The more the better, but also takes more time.- Returns:
- the number of different hyperparamter combinations which are executed
-
setNumberOfTrials
public void setNumberOfTrials(int numberOfTrials) Sets the number of trials which should be executed during hyperparameter search. This means how many different hyperparameter combinations should be tried out. The more the better, but also takes more time.- Parameters:
numberOfTrials
- the number of different hyperparamter combinations which are executed
-
getTestSize
public float getTestSize()Returns a number between zero and one which represents the proportion of the data to include in the test split.- Returns:
- a number between zero and one which represents the proportion of the data to include in the test split
-
setTestSize
public void setTestSize(float testSize) Sets the number between zero and one which represents the proportion of the data to include in the test split- Parameters:
testSize
- number between zero and one which represents the proportion of the data to include in the test split
-
getOptimizingMetric
Returns the metric which is optimized during hyperparameter search.- Returns:
- the metric which is optimized during hyperparameter search
-
setOptimizingMetric
Sets the metric which is optimized during hyperparameter search.- Parameters:
optimizingMetric
- the metric which is optimized during hyperparameter search
-
getHpSpace
Returns the initial hyper parameter search space. For nearly all algorithms except PBT, this is the only search space which should be defined.- Returns:
- the initial hyper parameter search space.
-
setHpSpace
Sets the initial hyper parameter search space. For nearly all algorithms except PBT, this is the only search space which should be defined.- Parameters:
hpSpace
- the initial hyper parameter search space
-
getHpMutations
Returns the mutations for the hyperparameter - only applicable for PBT (population based training).- Returns:
- the mutations for the hyperparameter
-
setHpMutations
Sets the mutations for the hyperparameter - only applicable for PBT (population based training).- Parameters:
hpMutations
- the mutations for the hyperparameter
-