static fromConfig(config, ...args) {
        switch (config.type) {
            case 'WordPiece':
                return new WordPieceTokenizer(config);
            case 'Unigram':
                // @ts-ignore
                return new Unigram(config, ...args);
            case 'BPE':
                return new BPE(config);

            default:
                // Some older tokenizers, like `google-t5/t5-small`, `openai-community/gpt2`, and `distilbert/distilbert-base-uncased`, do not have a `type` field.
                // In this case, we can infer the tokenizer type based on the structure of the `vocab` field and other properties.
                if (config.vocab) {
                    if (Array.isArray(config.vocab)) {
                        // config.vocab is of type `[string, number][]`
                        // @ts-ignore
                        return new Unigram(config, ...args);
                    } else if (Object.hasOwn(config, 'continuing_subword_prefix') && Object.hasOwn(config, 'unk_token')) {
                        if (Object.hasOwn(config, 'merges')) {
                            return new BPE(config);
                        } else {
                            return new WordPieceTokenizer(config);
                        }
                    } else {
                        // @ts-ignore
                        return new LegacyTokenizerModel(config, ...args);
                    }
                }
                throw new Error(`Unknown TokenizerModel type: ${config.type}`);
        }
    }
Instantiates a new TokenizerModel instance based on the configuration object provided.
@param {Object} config The configuration object for the TokenizerModel.
@param {...*} args Optional arguments to pass to the specific TokenizerModel constructor.
@returns {TokenizerModel} A new instance of a TokenizerModel.
@throws Will throw an error if the TokenizerModel type in the config is not recognized.