    def load(
        cls,
        config: Params,
        serialization_dir: Union[str, PathLike],
        weights_file: Optional[Union[str, PathLike]] = None,
        cuda_device: int = -1,
    ) -> "Model":
        """
        Instantiates an already-trained model, based on the experiment
        configuration and some optional overrides.

        # Parameters

        config : `Params`
            The configuration that was used to train the model. It should definitely
            have a `model` section, and should probably have a `trainer` section
            as well.
        serialization_dir: `str = None`
            The directory containing the serialized weights, parameters, and vocabulary
            of the model.
        weights_file: `str = None`
            By default we load the weights from `best.th` in the serialization
            directory, but you can override that value here.
        cuda_device: `int = -1`
            By default we load the model on the CPU, but if you want to load it
            for GPU usage you can specify the id of your GPU here

        # Returns

        model : `Model`
            The model specified in the configuration, loaded with the serialized
            vocabulary and the trained weights.
        """

        # Peak at the class of the model.
        model_type = (
            config["model"] if isinstance(config["model"], str) else config["model"]["type"]
        )

        # Load using an overridable _load method.
        # This allows subclasses of Model to override _load.

        model_class: Type[Model] = cls.by_name(model_type)  # type: ignore
        if not isinstance(model_class, type):
            # If you're using from_archive to specify your model (e.g., for fine tuning), then you
            # can't currently override the behavior of _load; we just use the default Model._load.
            # If we really need to change this, we would need to implement a recursive
            # get_model_class method, that recurses whenever it finds a from_archive model type.
            model_class = Model
        return model_class._load(config, serialization_dir, weights_file, cuda_device)
Instantiates an already-trained model, based on the experiment
configuration and some optional overrides.

# Parameters

config : `Params`
The configuration that was used to train the model. It should definitely
have a `model` section, and should probably have a `trainer` section
as well.
serialization_dir: `str = None`
The directory containing the serialized weights, parameters, and vocabulary
of the model.
weights_file: `str = None`
By default we load the weights from `best.th` in the serialization
directory, but you can override that value here.
cuda_device: `int = -1`
By default we load the model on the CPU, but if you want to load it
for GPU usage you can specify the id of your GPU here

# Returns

model : `Model`
The model specified in the configuration, loaded with the serialized
vocabulary and the trained weights.
allennlp/models/model.py