Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/cztomsik/ggml-js
/ functions
Functions
74 in github.com/cztomsik/ggml-js
⨍
Functions
74
◇
Types & classes
38
↓ 18 callers
Method
newTensor
* Create a new tensor (shape in reverse order). * @param {string} type - Tensor type. * @param {...number} dims - Tensor shape.
lib/core/context.js:41
↓ 17 callers
Method
callOp
(nativeFun, ...args)
lib/core/context.js:32
↓ 16 callers
Function
unaryOp
lib/core/functional.js:4
↓ 12 callers
Method
forward
(x, state, updates = [])
lib/llms/rwkv.js:35
↓ 11 callers
Method
set
* Set value at the given index. * @param {number} index * @param {number} value * @returns {Tensor}
lib/core/tensor.js:72
↓ 10 callers
Method
forward
(x)
lib/llms/gpt-neox.js:87
↓ 9 callers
Method
loadFromFile
* Load a model from a file. * @type {<T extends typeof Model>(this: T, path: string, hparams?: ConstructorParameters<T>[1]) => InstanceType<T>}
lib/core/model.js:26
↓ 7 callers
Function
binaryOp
lib/core/functional.js:5
↓ 7 callers
Method
get
* Get value at the given index. * @param {number} index * @returns {number}
lib/core/tensor.js:58
↓ 5 callers
Method
decodeOne
* Decode one token into a Uint8Array. * @param {number} token * @returns {Uint8Array} * @abstract
lib/tokenizers/tokenizer.js:65
↓ 5 callers
Method
encode
* Encode a string into tokens. * @param {string} text * @returns {number[]} * @abstract
lib/tokenizers/tokenizer.js:36
↓ 5 callers
Function
mix
(x, prev_x, w)
lib/llms/rwkv.js:125
↓ 4 callers
Method
compute
* Compute the graph.
lib/core/context.js:72
↓ 4 callers
Method
generate
* @param {number[]} input - Array of input token IDs. * @param {object} [options] * @param {number} [options.max_tokens=100] - Maximum number of
lib/llms/causal.js:43
↓ 4 callers
Method
init
* Initialize the context.
lib/core/context.js:20
↓ 3 callers
Method
buildForward
* Build a graph for forward computation. * @param {Tensor} tensor
lib/core/context.js:51
↓ 3 callers
Function
wrap
(Clz, obj, ...extra)
lib/core/native.js:15
↓ 2 callers
Method
bpe
(word)
lib/tokenizers/bpe-tokenizer.js:54
↓ 2 callers
Method
collectTensors
* Go through all tensors in the model and collect them with their names. * @returns {Array<[string, Tensor]>}
lib/core/model.js:77
↓ 2 callers
Method
split
* Split a tensor into chunks of the given size along the first dimension. * @param {number} chunkSize * @returns {Tensor[]}
lib/core/tensor.js:151
↓ 2 callers
Method
view
* Get a view of the tensor (shape in reverse order). * @param {...number} dims * @returns {Tensor}
lib/core/tensor.js:87
↓ 1 callers
Method
buildForwardExpand
* TODO: document this
lib/core/context.js:93
↓ 1 callers
Method
contiguous
* Make the tensor contiguous in memory. * @returns {Tensor}
lib/core/tensor.js:179
↓ 1 callers
Method
decode
* Decode tokens into a string. * @param {number[]} tokens * @returns {string}
lib/tokenizers/tokenizer.js:45
↓ 1 callers
Method
encode
* @override
lib/tokenizers/bpe-tokenizer.js:38
↓ 1 callers
Method
forward
* @param {Tensor} x - Input tensor. * @param {any} state * @param {Tensor[]} updates - Array of tensors that should be updated after the forward
lib/llms/causal.js:19
↓ 1 callers
Method
getInitialState
* Prepare the initial state. * @param {Context} cx * @returns {any} Initial state. * @abstract
lib/llms/causal.js:29
↓ 1 callers
Method
merge
(word, bigram)
lib/tokenizers/bpe-tokenizer.js:64
↓ 1 callers
Method
permute
* Permute the tensor. * @param {number} axis0 * @param {number} axis1 * @param {number} axis2 * @param {number} axis3 * @returns {Tenso
lib/core/tensor.js:134
↓ 1 callers
Method
print
* Print all tensors in the model.
lib/core/model.js:101
↓ 1 callers
Method
setAll
* Set all elements to the given value. * @param {number} value * @returns {Tensor}
lib/core/tensor.js:41
Method
constructor
({ vocab, merges, added_tokens })
lib/tokenizers/bpe-tokenizer.js:15
Method
constructor
* Create an empty model. * @param {Context} context * @param {Object} hparams
lib/core/model.js:15
Method
constructor
* @param {Module} parentModule - A parent module. * @param {number} numEmbeddings - The size of the vocabulary. * @param {number} dim - The embe
lib/core/layers.js:13
Method
constructor
* @param {Module} parentModule - A parent module. * @param {number} dim - The embedding dimension.
lib/core/layers.js:33
Method
constructor
* @param {Module} parentModule - A parent module. * @param {number} inputDim - The input dimension. * @param {number} outputDim - The output dim
lib/core/layers.js:55
Method
constructor
* Create a new module. * @param {Module} parentModule
lib/core/module.js:16
Method
constructor
* Create a new RWKV model. * @param {Context} context * @param {{ vocab_size: number, embed_dim: number, num_layers: number }} hparams
lib/llms/rwkv.js:20
Method
constructor
(parentModule, dim)
lib/llms/rwkv.js:43
Method
constructor
(parentModule, dim)
lib/llms/rwkv.js:58
Method
constructor
(parentModule, dim)
lib/llms/rwkv.js:104
Method
constructor
(context, { vocab_size, embed_dim, num_layers, num_heads, num_rot })
lib/llms/gpt-neox.js:5
Method
constructor
(parentModule, embed_dim, num_heads, num_rot)
lib/llms/gpt-neox.js:25
Method
constructor
(parentModule, embed_dim, num_heads, num_rot)
lib/llms/gpt-neox.js:42
Method
constructor
(parentModule, dim)
lib/llms/gpt-neox.js:81
Method
decodeOne
* @override
lib/tokenizers/bpe-tokenizer.js:75
Method
elementSize
* Size of one element in bytes. * @returns {BigInt}
lib/core/tensor.js:32
Function
embedding
(input, weight)
lib/core/functional.js:117
Method
escape
({ content })
lib/tokenizers/bpe-tokenizer.js:31
Function
flashAttention
(q, k, v, masked)
lib/core/functional.js:137
Method
forward
(x)
lib/core/layers.js:20
Method
forward
(x)
lib/core/layers.js:39
Method
forward
(x)
lib/core/layers.js:63
Method
forward
(x, state, updates)
lib/llms/rwkv.js:51
Method
forward
(x, [_, prev_x, aa, bb, pp], updates)
lib/llms/rwkv.js:71
Method
forward
(x, [prev_x], updates)
lib/llms/rwkv.js:113
Method
forward
(x, state, updates = [])
lib/llms/gpt-neox.js:13
Method
forward
(x)
lib/llms/gpt-neox.js:33
Method
forward
(x)
lib/llms/gpt-neox.js:58
Method
getInitialState
(ctx)
lib/llms/rwkv.js:28
Method
getInitialState
(ctx)
lib/llms/gpt-neox.js:19
Method
loadFromFile
* Load a tokenizer from a file. * @type {<T extends typeof Tokenizer>(this: T, path: string) => InstanceType<T>}
lib/tokenizers/tokenizer.js:15
Function
matmul
(a, b)
lib/core/functional.js:143
Method
print
* Print info about the graph.
lib/core/context.js:86
Method
printObjects
* Print GGML objects
lib/core/context.js:58
Function
repeat
(a, b)
lib/core/functional.js:127
Method
reset
* Reset the graph.
lib/core/context.js:79
Method
reshape
* Reshape the tensor. * @param {...number} dims * @returns {Tensor}
lib/core/tensor.js:120
Function
rope
(a, n_past, n_rot, mode)
lib/core/functional.js:132
Method
shape
* Tensor shape (in reverse order). * @returns {number[]}
lib/core/tensor.js:24
Method
toString
* Debug string.
lib/core/tensor.js:186
Method
transpose
* Transpose the tensor. * @returns {Tensor}
lib/core/tensor.js:142
Method
type
* Tensor type. * @returns {string}
lib/core/tensor.js:16
Method
visit
(obj, prefix)
lib/core/model.js:79