Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/RWKV/rwkv.cpp
/ functions
Functions
91 in github.com/RWKV/rwkv.cpp
⨍
Functions
91
◇
Types & classes
25
↓ 11 callers
Function
rwkv_get_state_len
API function.
rwkv.cpp:171
↓ 10 callers
Method
encode
(self, src: str)
python/rwkv_cpp/rwkv_world_tokenizer.py:108
↓ 10 callers
Function
save_thread_state
(_thread: str)
python/chat_with_bot.py:82
↓ 9 callers
Method
_get_data_ptr
(self, tensor: NumpyArrayOrPyTorchTensor)
python/rwkv_cpp/rwkv_cpp_model.py:353
↓ 9 callers
Method
_validate_tensor
(self, tensor: NumpyArrayOrPyTorchTensor, name: str, size: int)
python/rwkv_cpp/rwkv_cpp_model.py:330
↓ 8 callers
Function
rwkv_get_logits_len
API function.
rwkv.cpp:182
↓ 7 callers
Function
process_tokens
(_tokens: List[int], new_line_logit_bias: float = 0.0)
python/chat_with_bot.py:71
↓ 6 callers
Method
_zeros_float32
(self, element_count: int, use_numpy: bool)
python/rwkv_cpp/rwkv_cpp_model.py:359
↓ 6 callers
Function
load_thread_state
(_thread: str)
python/chat_with_bot.py:89
↓ 5 callers
Function
rwkv_free
API function.
rwkv.cpp:187
↓ 5 callers
Function
rwkv_get_last_error
API function.
rwkv.cpp:229
↓ 4 callers
Function
add_tokenizer_argument
(parser)
python/tokenizer_util.py:6
↓ 4 callers
Function
get_tokenizer
(tokenizer_name: str, n_vocab: int)
python/tokenizer_util.py:15
↓ 4 callers
Function
rwkv_init_from_file
API function.
rwkv.cpp:71
↓ 3 callers
Method
_detect_numpy_usage
(self, tensors: List[Optional[NumpyArrayOrPyTorchTensor]], use_numpy_by_default: bool)
python/rwkv_cpp/rwkv_cpp_model.py:323
↓ 3 callers
Method
_is_pytorch_tensor
(self, tensor: NumpyArrayOrPyTorchTensor)
python/rwkv_cpp/rwkv_cpp_model.py:320
↓ 3 callers
Method
eval
Evaluates the model for a single token. In case of any error, this method will throw an exception. Parameters ------
python/rwkv_cpp/rwkv_cpp_model.py:85
↓ 3 callers
Method
eval_sequence_in_chunks
Evaluates the model for a sequence of tokens using `eval_sequence`, splitting a potentially long sequence into fixed-length chunks. T
python/rwkv_cpp/rwkv_cpp_model.py:225
↓ 3 callers
Function
rwkv_get_system_info_string
API function.
rwkv.cpp:239
↓ 2 callers
Method
decode
(self, tokens: List[int])
python/rwkv_cpp/rwkv_world_tokenizer.py:111
↓ 2 callers
Function
format_loss_with_perplexity
(loss: torch.Tensor)
python/measure_pexplexity.py:59
↓ 2 callers
Method
free
Frees all allocated resources. In case of any error, this method will throw an exception. The object must not be used anymore
python/rwkv_cpp/rwkv_cpp_model.py:301
↓ 2 callers
Method
rwkv_get_system_info_string
Returns system information string.
python/rwkv_cpp/rwkv_cpp_shared_library.py:368
↓ 2 callers
Function
test_on_prompt
tests/test_eval_sequence_in_chunks.c:10
↓ 1 callers
Method
add
(self, key: bytes, idx: int = 0, val=None)
python/rwkv_cpp/rwkv_world_tokenizer.py:16
↓ 1 callers
Method
decode_bytes
(self, tokens: List[int])
python/rwkv_cpp/rwkv_world_tokenizer.py:105
↓ 1 callers
Method
encode_bytes
(self, src: bytes)
python/rwkv_cpp/rwkv_world_tokenizer.py:92
↓ 1 callers
Method
find_longest
(self, key: bytes, idx: int = 0)
python/rwkv_cpp/rwkv_world_tokenizer.py:32
↓ 1 callers
Function
format_loss
(loss: torch.Tensor)
python/measure_pexplexity.py:56
↓ 1 callers
Function
get_layer_count
(state_dict: Dict[str, torch.Tensor])
python/convert_pytorch_to_ggml.py:18
↓ 1 callers
Function
main
()
python/convert_pytorch_to_ggml.py:163
↓ 1 callers
Function
main
()
python/quantize.py:17
↓ 1 callers
Function
main
()
python/merge_lora_into_ggml.py:45
↓ 1 callers
Function
parse_args
()
python/measure_pexplexity.py:14
↓ 1 callers
Function
parse_args
()
python/convert_pytorch_to_ggml.py:11
↓ 1 callers
Function
parse_args
()
python/quantize.py:8
↓ 1 callers
Function
parse_args
()
python/merge_lora_into_ggml.py:13
↓ 1 callers
Function
rwkv_clone_context
API function.
rwkv.cpp:123
↓ 1 callers
Method
rwkv_eval
Evaluates the model for a single token. Throws an exception in case of any error. Error messages would be printed to stderr.
python/rwkv_cpp/rwkv_cpp_shared_library.py:131
↓ 1 callers
Method
rwkv_eval_sequence
Evaluates the model for a sequence of tokens. Uses a faster algorithm than `rwkv_eval` if you do not need the state and logits for ev
python/rwkv_cpp/rwkv_cpp_shared_library.py:167
↓ 1 callers
Method
rwkv_eval_sequence_in_chunks
Evaluates the model for a sequence of tokens using `rwkv_eval_sequence`, splitting a potentially long sequence into fixed-length chunks.
python/rwkv_cpp/rwkv_cpp_shared_library.py:216
↓ 1 callers
Method
rwkv_free
Frees all allocated memory and the context. Parameters ---------- ctx : RWKVContext RWKV context obtaine
python/rwkv_cpp/rwkv_cpp_shared_library.py:329
↓ 1 callers
Method
rwkv_get_logits_buffer_element_count
Returns count of FP32 elements in logits buffer. Parameters ---------- ctx : RWKVContext RWKV context ob
python/rwkv_cpp/rwkv_cpp_shared_library.py:317
↓ 1 callers
Method
rwkv_get_n_embed
Returns the number of elements in the given model's embedding. Useful for reading individual fields of a model's hidden state.
python/rwkv_cpp/rwkv_cpp_shared_library.py:277
↓ 1 callers
Method
rwkv_get_n_layer
Returns the number of layers in the given model. A layer is a pair of RWKV and FFN operations, stacked multiple times throughout the
python/rwkv_cpp/rwkv_cpp_shared_library.py:290
↓ 1 callers
Method
rwkv_get_n_vocab
Returns the number of tokens in the given model's vocabulary. Useful for telling 20B_tokenizer models (n_vocab = 50277) apart from Wo
python/rwkv_cpp/rwkv_cpp_shared_library.py:264
↓ 1 callers
Method
rwkv_get_state_buffer_element_count
Returns count of FP32 elements in state buffer. Parameters ---------- ctx : RWKVContext RWKV context obt
python/rwkv_cpp/rwkv_cpp_shared_library.py:305
↓ 1 callers
Method
rwkv_init_from_file
Loads the model from a file and prepares it for inference. Throws an exception in case of any error. Error messages would be printed
python/rwkv_cpp/rwkv_cpp_shared_library.py:111
↓ 1 callers
Method
rwkv_quantize_model_file
Quantizes FP32 or FP16 model to one of INT4 formats. Throws an exception in case of any error. Error messages would be printed to std
python/rwkv_cpp/rwkv_cpp_shared_library.py:343
↓ 1 callers
Function
rwkv_set_print_errors
API function.
rwkv.cpp:218
↓ 1 callers
Function
sample_probs
(probs: np.ndarray, temperature: float = 1.0, top_p: float = 0.8, logit_bias: Dict[int, float] = None)
python/sampling.py:18
↓ 1 callers
Function
softmax
(x: np.ndarray, axis: int)
python/sampling.py:5
↓ 1 callers
Function
split_last_end_of_line
(tokens: List[int])
python/chat_with_bot.py:100
↓ 1 callers
Function
test
()
python/convert_pytorch_to_ggml.test.py:7
↓ 1 callers
Function
test
()
python/rwkv_cpp/rwkv_world_tokenizer.test.py:4
↓ 1 callers
Function
test_computation_on_tensors_from_different_contexts
RWKV model loading code depends on this behavior.
tests/test_ggml_basics.c:61
↓ 1 callers
Function
test_sequential_mode
tests/test_logit_calculation_skipping.c:54
↓ 1 callers
Function
test_serial_mode
tests/test_logit_calculation_skipping.c:14
↓ 1 callers
Function
test_simple_computation
tests/test_ggml_basics.c:14
↓ 1 callers
Function
type_from_string
extras/quantize.c:25
↓ 1 callers
Function
write_parameter
(out_file, key: str, parameter: torch.Tensor)
python/merge_lora_into_ggml.py:22
↓ 1 callers
Function
write_state_dict
(state_dict: Dict[str, torch.Tensor], dest_path: str, data_type: str)
python/convert_pytorch_to_ggml.py:28
Method
__del__
(self)
python/rwkv_cpp/rwkv_cpp_model.py:315
Method
__init__
(self, front=None, ch=None)
python/rwkv_cpp/rwkv_world_tokenizer.py:10
Method
__init__
(self, file_path)
python/rwkv_cpp/rwkv_world_tokenizer.py:68
Method
__init__
Loads the model and prepares it for inference. In case of any error, this method will throw an exception. Parameters
python/rwkv_cpp/rwkv_cpp_model.py:27
Method
__init__
(self, ptr: ctypes.pointer)
python/rwkv_cpp/rwkv_cpp_shared_library.py:23
Method
__init__
Loads the shared library from specified file. In case of any error, this method will throw an exception. Parameters
python/rwkv_cpp/rwkv_cpp_shared_library.py:31
Method
__repr__
(self)
python/rwkv_cpp/rwkv_world_tokenizer.py:54
Method
eval_sequence
Evaluates the model for a sequence of tokens. NOTE ON GGML NODE LIMIT ggml has a hard-coded limit on max amount of nodes in
python/rwkv_cpp/rwkv_cpp_model.py:150
Function
get_world_tokenizer_v20230424
Loads the default World tokenizer, commonly used in RWKV v4 World models. Returns a tuple of `decode` and `encode` functions.
python/rwkv_cpp/rwkv_world_tokenizer.py:116
Function
load_rwkv_shared_library
Attempts to find rwkv.cpp shared library and load it. To specify exact path to the library, create an instance of RWKVSharedLibrary explicitl
python/rwkv_cpp/rwkv_cpp_shared_library.py:375
Function
main
tests/test_quantized_matmul_on_gpu.c:26
Function
main
tests/test_quantization_format_compatibility.c:11
Function
main
tests/test_eval_sequence_in_chunks.c:68
Function
main
tests/test_ggml_basics.c:102
Function
main
tests/test_tiny_rwkv.c:12
Function
main
tests/test_context_cloning.c:10
Function
main
tests/test_logit_calculation_skipping.c:92
Function
main
extras/quantize.c:36
Function
main
extras/cpu_info.c:5
Method
n_embed
(self)
python/rwkv_cpp/rwkv_cpp_model.py:78
Method
n_layer
(self)
python/rwkv_cpp/rwkv_cpp_model.py:82
Method
n_vocab
(self)
python/rwkv_cpp/rwkv_cpp_model.py:74
Function
rwkv_get_logits_buffer_element_count
rwkv.cpp:151
Function
rwkv_get_n_embed
API function.
rwkv.cpp:161
Function
rwkv_get_n_layer
API function.
rwkv.cpp:166
Function
rwkv_get_n_vocab
API function.
rwkv.cpp:156
Function
rwkv_get_print_errors
API function.
rwkv.cpp:224
Function
rwkv_get_state_buffer_element_count
rwkv.cpp:145
Function
sample_logits
(out, temperature: float = 1.0, top_p: float = 0.8, logit_bias: Dict[int, float] = None)
python/sampling.py:10