(source: Union[Path, str], config: Dict)
return tokenizer, transformer
Create a Huggingface transformer model from pretrained weights. Will
    download the model if it is not already downloaded.

    source (Union[str, Path]): The name of the model or a path to it, such as
        'bert-base-cased'.
    config (dict): Settings to pass to the tokenizer.
Create a Huggingface transformer model from pretrained weights. Will
    download the model if it is not already downloaded.
Create a Huggingface transformer model from pretrained weights . Will download the model if it is not already downloaded .
def huggingface_from_pretrained(source: Union[Path, str], config: Dict):
    """Create a Huggingface transformer model from pretrained weights. Will
    download the model if it is not already downloaded.

    source (Union[str, Path]): The name of the model or a path to it, such as
        'bert-base-cased'.
    config (dict): Settings to pass to the tokenizer.
    """
    warnings.warn(
        "spacy_transformers.util.huggingface_from_pretrained has been moved to "
        "spacy_transformers.layers.transformer_model.huggingface_from_pretrained "
        "with an updated API:\n"
        "huggingface_from_pretrained(source, tok_config, trf_config) -> HFObjects",
        DeprecationWarning,
    )
    if hasattr(source, "absolute"):
        str_path = str(source.absolute())
    else:
        str_path = source
    tokenizer = AutoTokenizer.from_pretrained(str_path, **config)
    transformer = AutoModel.from_pretrained(str_path)
    ops = get_current_ops()
    if isinstance(ops, CupyOps):
        transformer.cuda()
    return tokenizer, transformer
def huggingface_from_pretrained ( source : Union [ Path , str ] , config : Dict ) : warnings . warn ( "spacy_transformers.util.huggingface_from_pretrained has been moved to " "spacy_transformers.layers.transformer_model.huggingface_from_pretrained " "with an updated API:\n" "huggingface_from_pretrained(source, tok_config, trf_config) -> HFObjects" , DeprecationWarning , ) if hasattr ( source , "absolute" ) : str_path = str ( source . absolute ( ) ) else : str_path = source tokenizer = AutoTokenizer . from_pretrained ( str_path , * * config ) transformer = AutoModel . from_pretrained ( str_path ) ops = get_current_ops ( ) if isinstance ( ops , CupyOps ) : transformer . cuda ( ) return tokenizer , transformer