FINALFRONTIER-SKIPGRAM(1)
okay so bestie, you found finalfrontier-skipgram(1) and weβre gonna make it make sense π
β¨ this is the finalfrontier skipgram subcommand β the one that trains word embeddings with subword representations β and I promise itβs giving legendary, not scary.
π NAME π
finalfrontier skipgram β train word embeddings with subword representations π¦
β¨ SYNOPSIS β¨
finalfrontier skipgram [options] corpus output
πΈ DESCRIPTION πΈ
The finalfrontier skipgram subcommand trains word embeddings using data from a corpus. The corpus should have tokens separated by spaces and sentences separated by newlines. After training, the embeddings are written to output in the finalfusion format. slay. π
π OPTIONS π
--buckets EXPβ the bucket exponent. finalfrontier uses2^EXPbuckets to store subword representations. Each subword representation (n-gram) is hashed and mapped to a bucket based on this hash. using more buckets means fewer bucket collisions between subword representations, at the cost of memory use. the default bucket exponent is21(approximately 2 million buckets). β¨--context CONTEXT_SIZEβ words within theCONTEXT_SIZEof a focus word will be used to learn the representation of the focus word. the default context size is10.--dims DIMENSIONSβ the dimensionality of the trained word embeddings. the default dimensionality is300.--discard THRESHOLDβ the discard threshold influences how often frequent words are discarded from training. the default discard threshold is1e-4.--epochs Nβ the number of training epochs. the number of necessary training epochs typically decreases with the corpus size. the default number of epochs is15.-f,--format FORMATβ the output format. this must be one offasttext,finalfusion,word2vec,text, andtextdims.- all formats, except finalfusion, result in a loss of information:
word2vec,text, andtextdimsdo not store subword embeddings, nor hyperparameters. thefastTextformat does not store all hyperparameters. - the
fasttextformat can only be used in conjunction with--subwords bucketsand--hash-indexer fasttext.
- all formats, except finalfusion, result in a loss of information:
--hash-indexer INDEXERβ the indexer to use when bucket-based subwords are used (see--subwords). the possible values arefinalfusionorfasttext. default:finalfusion.finalfusionuses the FNV-1a hasher, whereasfasttextemulates the (broken) implementation of FNV-1a in fastText. use of finalfusion is recommended, unless the resulting embeddings should be compatible with fastText. π
--lr LEARNING_RATEβ the learning rate determines what fraction of a gradient is used for parameter updates. the default initial learning rate is0.05; the learning rate decreases monotonically during training.--maxn LENβ the maximum n-gram length for subword representations. default:6.--mincount FREQβ the minimum count controls discarding of infrequent words. words occurring fewer thanFREQtimes are not considered during training. the default minimum count is5.--minn LENβ the minimum n-gram length for subword representations. default:3.--model MODELβ the model to use for training word embeddings. the choices here are:dirgramfor the directional skip-gram model (Song et al., 2018),skipgramfor the skip-gram model (Mikolov et al., 2013), andstructgramfor the structured skip-gram model (Ling et al. 2015).- the structured skip-gram model takes the position of a context word into account and results in embeddings that are typically better suited for syntax-oriented tasks. π
- the dependency embeddings model is supported by the separate
finalfrontier deps(1)subcommand. - the default model is
skipgram.
--ngram-mincount FREQβ the minimum n-gram frequency. n-grams occurring fewer thanFREQtimes are excluded from training. this option is only applicable with thengramsargument of the subwords option.--ngram-target-size SIZEβ the target size for the n-gram vocabulary. at mostSIZEn-grams are included for training. only n-grams appearing more frequently than the n-gram atSIZEare included. this option is only applicable with thengramsargument of the subwords option.--ns FREQβ the number of negatives to sample per positive example. default:5.--subwords SUBWORDSβ the type of subword embeddings to train. the possible types arebuckets,ngrams, andnone. subword embeddings are used to compute embeddings for unknown words by summing embeddings of n-grams within unknown words. π¦- the
nonetype does not use subwords. the resulting model will not be able to assign an embedding to unknown words. - the
ngramstype stores subword n-grams explicitly. the included n-gram lengths are specified using the--minnand--maxnoptions. the frequency threshold for n-grams is configured with the--ngram-mincountoption. - the
bucketstype maps n-grams to buckets using the FNV1 hash. the considered n-gram lengths are specified using the--minnand--maxnoptions. the number of buckets is controlled with the--bucketsoption.
- the
--target-size SIZEβ the target size for the token vocabulary. at mostSIZEtokens are included for training. only tokens appearing more frequently than the token atSIZEare included.--threads Nβ the number of threads to use during training for parallelization. the default is to use half of the logical CPUs of the machine, capped at 20 threads. increasing the number of threads increases the probability of update collisions, requiring more epochs to reach the same loss. π--zipf EXPβ exponentsused in the Zipf distributionp(k) = 1 / (k^s H_N)for negative sampling. default:0.5.
π¦ EXAMPLES π¦
train embeddings on dewiki.txt using the skip-gram model:
finalfrontier skipgram dewiki.txt dewiki-skipgram.bin
train embeddings with dimensionality 200 on dewiki.txt using the structured skip-gram model with a context window of 5 tokens:
finalfrontier skipgram --model structgram --context 5 --dims 200 \
dewiki.txt dewiki-structgram.bin
π₯ SEE ALSO π₯
finalfrontier(1), finalfrontier-deps(1)
π AUTHORS π
Daniel de Kok.
and thatβs the whole page, bestie π«Ά this is from the FINALFRONTIER-SKIPGRAM(1) source/version and itβs dated Sep 8, 2018 β periodt π
β¨
π¦ where this page comes from
- nixos 26.05: finalfrontier-unstable 2022-01-06
- nixpkgs unstable: finalfrontier 0.9.4-unstable-2022-01-06
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms