dot-infer_model_paths: Find Paths to Checkpoint Files

.infer_model_pathsR Documentation

Find Paths to Checkpoint Files

Description

In some functions, the user can specify a model, a ckpt_dir, and/or specific paths to checkpoint files. This function sorts all of that out.

Usage

.infer_model_paths(
  model = c("bert_base_uncased", "bert_base_cased", "bert_large_uncased",
    "bert_large_cased", "bert_large_uncased_wwm", "bert_large_cased_wwm",
    "bert_base_multilingual_cased", "bert_base_chinese", "scibert_scivocab_uncased",
    "scibert_scivocab_cased", "scibert_basevocab_uncased", "scibert_basevocab_cased"),
  ckpt_dir = NULL,
  vocab_file = find_vocab(ckpt_dir),
  bert_config_file = find_config(ckpt_dir),
  init_checkpoint = find_ckpt(ckpt_dir)
)

Arguments

model

Character; which model checkpoint to use. If specified, ckpt_dir, codevocab_file, bert_config_file, and init_checkpoint will be inferred. If you do not have this checkpoint, you will be prompted to download it in interactive mode.

ckpt_dir

Character; path to checkpoint directory. If specified, any other checkpoint files required by this function (vocab_file, bert_config_file, or init_checkpoint) will default to standard filenames within ckpt_dir.

vocab_file

path to vocabulary file. File is assumed to be a text file, with one token per line, with the line number corresponding to the index of that token in the vocabulary.

bert_config_file

Character; the path to a json config file.

init_checkpoint

Character; path to the checkpoint directory, plus checkpoint name stub (e.g. "bert_model.ckpt"). Path must be absolute and explicit, starting with "/".

Value

A list with components vocab_file, bert_config_file, and init_checkpoint.


jonathanbratt/RBERT documentation built on Jan. 26, 2023, 4:15 p.m.