Enum TransformersMultiProcessing
java.lang.Object
java.lang.Enum<TransformersMultiProcessing>
de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersMultiProcessing
- All Implemented Interfaces:
Serializable
,Comparable<TransformersMultiProcessing>
,java.lang.constant.Constable
The transformers library may not free all memory from GPU.
Thus the prediction and training are wrapped in an external process.
This enum defines how the process is started and if multiprocessing should be used at all.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThis uses the default start method for the operating system.This uses os.fork() to fork the python interpreter.This uses a server process to start a new process.The transformer model is executed directly in the main process.The main process starts a fresh python interpreter. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiontoString()
static TransformersMultiProcessing
Returns the enum constant of this type with the specified name.static TransformersMultiProcessing[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NO_MULTI_PROCESS
The transformer model is executed directly in the main process. If you call the Transformers matcher in MELT multiple times, then this can lead to memory issues. -
DEFAULT_MULTI_PROCESS
This uses the default start method for the operating system. This isSPAWN
for Windows and macOS, andFORK
for Unix. See also the python documentation about it. -
SPAWN
The main process starts a fresh python interpreter. Available on Unix and Windows. See also the python documentation about it. -
FORK
This uses os.fork() to fork the python interpreter. Available on Unix only. This may result in the following error: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method. . See also the python documentation about it. -
FORKSERVER
This uses a server process to start a new process. Available only on Unix. See also the python documentation about it.
-
-
Constructor Details
-
TransformersMultiProcessing
private TransformersMultiProcessing()
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
toString
- Overrides:
toString
in classEnum<TransformersMultiProcessing>
-