### RWKV-LM Pre-training Setup Source: https://context7.com/rwkv/rwkv-wiki/llms.txt This section outlines the steps for cloning the RWKV-LM repository, installing dependencies, preparing datasets using `make_data.py`, and initializing a model for pre-training. Note the critical values `--my_exit_tokens` and `--magic_prime` obtained from `make_data.py` which are required for subsequent training scripts. ```bash # Clone RWKV-LM git clone https://github.com/BlinkDL/RWKV-LM.git cd RWKV-LM # Install dependencies (CUDA 12.1 example) pip install torch --upgrade --extra-index-url https://download.pytorch.org/whl/cu121 pip install pytorch-lightning==1.9.5 deepspeed wandb ninja --upgrade # Prepare dataset: place demo.jsonl in RWKV-LM/RWKV-v5 then convert python make_data.py demo.jsonl 30 4096 # Output: demo.bin, demo.idx, and critical values --my_exit_tokens and --magic_prime # Save those two values — they are required in the training scripts below. # Edit RWKV-LM/RWKV-v7/train_temp/demo-training-prepare.sh: # MODEL_TYPE="x070" # RWKV-7; use x060 for RWKV-6 # N_LAYER="12" # 12 layers → 0.1B model # N_EMBD="768" # must be multiple of 64 # CTX_LEN="4096" data_file="path/to/demo" # no .bin/.idx # --my_exit_tokens # --magic_prime sh demo-training-prepare.sh # initializes rwkv-init model # Edit demo-training-run.sh — key parameters: # M_BSZ=16 # batch size; larger = faster but more VRAM # LR_INIT="6e-4" # formula: 0.45 / N_EMBD ``` -------------------------------- ### Launch Text Generation WebUI on Windows Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/text-generation-webui.md Execute this batch script to start Text Generation WebUI on a Windows system. It handles dependency installation and environment setup. ```batch ./start_windows.bat ``` -------------------------------- ### Install RWKV Training Dependencies Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/training-enviroment.md Install essential libraries for RWKV training, including PyTorch Lightning, DeepSpeed, and other common machine learning toolkits. Use --upgrade to ensure the latest compatible versions are installed. ```bash # Specify to install the 1.9.5 version of PyTorch Lightning and other commonly used machine learning toolkits # The --upgrade parameter means that if the corresponding software package is already installed in the environment, it will be upgraded to the latest version pip install pytorch-lightning==1.9.5 deepspeed wandb ninja --upgrade # The following are some other toolkits that will be used when training with RWKV-PEFT. It is recommended to install them in advance pip install bitsandbytes einops triton rwkv-fla rwkv transformers GPUtil plotly gradio datasets ``` -------------------------------- ### Verify PyTorch and CUDA Installation Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/pretrain.md Verify the installed PyTorch version and CUDA availability by running a Python command. The expected output indicates a successful setup. ```python python -c "import torch; print(torch.__version__, torch.cuda.is_available())" ``` -------------------------------- ### Download and Install Miniconda Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/training-enviroment.md Download the latest Miniconda installer for Linux x86_64 and run the installation script. Ensure to accept the terms and restart environment variables. ```bash # Download the latest MiniConda installation package wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh # Run the installation script of the MiniConda installation package. Pay attention to the progress during the installation and enter "yes" in time! sh Miniconda3-latest-Linux-x86_64.sh -u # Restart the environment variables and activate the Conda environment source ~/.bashrc ``` -------------------------------- ### RWKV Training Configuration Example Source: https://context7.com/rwkv/rwkv-wiki/llms.txt Example shell script configuration for training an RWKV model. Includes settings for learning rate, gradient checkpointing, and distributed training strategy. ```shell # LR_FINAL="6e-5" # formula: 0.04 / N_EMBD # GRAD_CP=1 # 1 = save VRAM, 0 = faster # GPU_PER_NODE=1 # --strategy deepspeed_stage_2 # best balance of VRAM / speed # --wandb "MyProject" # optional WandB monitoring sh demo-training-run.sh # starts training; auto-resumes from latest checkpoint on re-run # VRAM requirements (M_BSZ=1, CTX_LEN=4096): # 0.1B (L12-D768): 6.4 GB # 0.4B (L24-D1024): 12.1 GB # 1.5B (L24-D2048): 41.1 GB # 3B (L32-D2560): 89.2 GB # Output: RWKV-LM/RWKV-v7/train_temp/out/rwkv-final.pth # Test with RWKV Runner or rwkv pip API_DEMO_CHAT.py ``` -------------------------------- ### Install PyTorch Lightning and ML Toolkits Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/pretrain.md Install PyTorch Lightning version 1.9.5 along with other essential machine learning libraries like deepspeed, wandb, and ninja. The --upgrade flag ensures packages are updated if already installed. ```bash pip install pytorch-lightning==1.9.5 deepspeed wandb ninja --upgrade ``` -------------------------------- ### Start Local llama.cpp Server Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/sillytraven.md Use this command to start a local llama.cpp service for RWKV models. Ensure you have the model file and specify the port and GPU layers as needed. ```bash ./llama-server -m models/rwkv7-0.4B-world-F16.gguf --port 8080 -ngl 99 ``` -------------------------------- ### RWKV LoRA Fine-Tuning Setup and Run Source: https://context7.com/rwkv/rwkv-wiki/llms.txt This script demonstrates setting up the RWKV-PEFT environment, preparing data, and running LoRA fine-tuning on a single GPU. Ensure to adjust parameters like model paths, data files, and training configurations based on your specific setup. ```bash # Clone RWKV-PEFT git clone https://github.com/JL-er/RWKV-PEFT.git cd RWKV-PEFT pip install -r requirements.txt # Prepare training data in binidx or jsonl format (see training-datasets.md) # Then edit scripts/run_lora.sh — key parameters: # run_lora.sh example for RWKV7-1.5B on a single GPU: load_model="/home/rwkv/model/rwkv7-g1-1.5b-20250429-ctx4096.pth" proj_dir='/home/rwkv/out_model/lora_test' data_file=/home/rwkv/data/roleplay # no .bin/.idx extension n_layer=24 n_embd=2048 micro_bsz=8 epoch_save=1 epoch_steps=200 ctx_len=512 peft_config='{"r":32,"lora_alpha":32,"lora_dropout":0.05}' python train.py --load_model $load_model \ --proj_dir $proj_dir --data_file $data_file \ --vocab_size 65536 \ --data_type jsonl \ --n_layer $n_layer --n_embd $n_embd \ --ctx_len $ctx_len --micro_bsz $micro_bsz \ --epoch_steps $epoch_steps --epoch_count 5 --epoch_save $epoch_save \ --lr_init 1e-5 --lr_final 1e-5 \ --accelerator gpu --precision bf16 \ --devices 1 --strategy deepspeed_stage_1 --grad_cp 1 \ --my_testing "x070" \ --peft lora --peft_config $peft_config # Run training sh scripts/run_lora.sh # Output: merged .pth model in proj_dir, usable in RWKV Runner or Ai00 # VRAM requirements (ctxlen=1024, micro_bsz=1, r=64): # RWKV7-0.4B: 3.4 GB (bf16) / 2.7 GB (nf4) # RWKV7-1.5B: 5.6 GB (bf16) / 3.9 GB (nf4) # RWKV7-2.9B: 8.8 GB (bf16) / 5.7 GB (nf4) ``` -------------------------------- ### Start PiSSA Fine-Tuning Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/RWKV-Fine-Tuning/Pissa-Fine-Tuning.md Execute this command in the RWKV-PEFT directory to begin the PiSSA fine-tuning process. ```bash sh scripts/run_pissa.sh ``` -------------------------------- ### Install RWKV-FLA for Consumer GPUs Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/RWKV-FLA.md Installs the stable version of RWKV-FLA and its dependencies for consumer-grade GPUs. Recommended for most users. ```bash conda create -n rwkv-fla python=3.12 conda activate rwkv-fla pip3 install torch torchvision torchaudio --upgrade pip install --upgrade rwkv-fla ``` -------------------------------- ### Launch llama.cpp Web Service Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/llamacpp.md Start a web server to interact with llama.cpp models. Access the Web UI at http://127.0.0.1:8080. ```bash ./llama-server -m models/rwkv-7-world-2.9b-Q8_0.gguf -ngl 99 ``` -------------------------------- ### Install Dependencies Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/RWKV-Fine-Tuning/LoRA-Fine-Tuning.md Install the necessary Python dependencies for the RWKV-PEFT project by running this command in your terminal. Ensure you are in the cloned repository's directory. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Python Libraries for Model Conversion Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/ai00.md Install necessary Python libraries for converting .pth models to .st format using pip. ```bash pip install numpy torch safetensors ``` -------------------------------- ### Install Missing Python Module Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/RWKV-Fine-Tuning/FAQ.md Use this command to install a missing Python package when encountering a ModuleNotFoundError during the jsonl to binidx conversion. ```bash pip install xxx ``` -------------------------------- ### Example JSONL Data Format Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/training-datasets.md Illustrates the structure of JSONL data samples for fine-tuning, showing question-answer pairs for math problems and general conversation. ```jsonl {"text": "User: 1 + 1 = ?\n\nAssistant: 2"} {"text": "User: 1 + 2 = ?\n\nAssistant: 3"} {"text": "User: 1 + 3 = ?\n\nAssistant: 4"} ``` -------------------------------- ### Install PyTorch with CUDA Support Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/pretrain.md Install the specified version of PyTorch with CUDA 12.1 support. This command ensures compatibility with the CUDA toolkit. ```bash pip install torch --upgrade --extra-index-url https://download.pytorch.org/whl/cu121 ``` -------------------------------- ### Few-Shot Prompting Example Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/RWKV-Prompts/prompt-guidelines.md An example demonstrating few-shot prompting for translation. It includes pairs of English phrases and their Chinese translations, followed by a new English phrase for the model to translate. ```markdown User: Translate "hello, I love you." into Chinese. Assistant: 你好,我爱你。 User: Translate "how are you?" into Chinese. Assistant: 你好吗? User: Translate "I am fine, thank you." into Chinese. Assistant: ``` -------------------------------- ### Install PyTorch with CUDA Support Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/training-enviroment.md Install the specified CUDA 12.1 version of PyTorch using pip, ensuring it's upgraded if already present. ```bash # Install the CUDA 12.1 version of torch by specifying the URL pip install torch --upgrade --extra-index-url https://download.pytorch.org/whl/cu121 ``` -------------------------------- ### Get Available Adapters Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/ai00.md Returns all available GPUs and their drivers on the current device, which can be used to specify the GPU when loading a model. ```APIDOC ## GET /api/adapters ### Description Return all the GPUs and drivers of the current device, which are used to specify the GPU when loading the model. ### Method GET ### Endpoint `http://localhost:65530/api/adapters` ### Response #### Success Response (200) - Returns an array of strings, where each element represents an available GPU device and its driver type. - The format of each element in the array is: `"GPU Name (Driver Type)"`, such as `"AMD Radeon 780M Graphics (Vulkan)"`. - The index of the array (starting from 0) can be used as the `adapter` parameter in the `admin/models/load` API. For example, `"adapter": {"Manual": 0}` specifies to use the first GPU. ### Response Example ```json [ "AMD Radeon 780M Graphics (Vulkan)", "AMD Radeon 780M Graphics (Vulkan)", "AMD Radeon 780M Graphics (Dx12)", "AMD Radeon 780M Graphics (Dx12)", "AMD Radeon 780M Graphics (Gl)" ] ``` ::: warning As of version 0.5.9, Ai00 only supports Vulkan drivers and no longer supports OpenGL and DirectX drivers. ::: ``` -------------------------------- ### Install RWKV-FLA for High-Performance GPUs (Triton Nightly) Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/RWKV-FLA.md Installs RWKV-FLA using the Triton nightly version for potentially higher performance on high-end GPUs. Requires specific PyTorch and Triton nightly builds. Note: Triton nightly may contain bugs. ```bash conda create -n triton-nightly python=3.12 conda activate triton-nightly pip install -U --pre torch --index-url https://download.pytorch.org/whl/nightly/cu126 pip uninstall triton pytorch-triton -y pip install -U triton-nightly --index-url http://pypi.fla-org.com/simple --trusted-host pypi.fla-org.com pip install einops ninja datasets transformers numpy pip uninstall flash-linear-attention && pip install -U --no-use-pep517 git+https://github.com/fla-org/flash-linear-attention --no-deps conda install nvidia/label/cuda-12.6.3::cuda-nvcc pip install packaging psutil ninja pip install flash-attn --no-deps --no-cache-dir --no-build-isolation ``` -------------------------------- ### List Available GPU Adapters Source: https://context7.com/rwkv/rwkv-wiki/llms.txt Retrieves a list of all available GPU adapters that the server can utilize. This is a simple GET request to the /api/adapters endpoint. ```bash curl http://localhost:65530/api/adapters ``` -------------------------------- ### Prompt for JSON Output using BNF Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/ai00.md Example of a user prompt designed to elicit a JSON response from the model, based on a previously defined BNF grammar. ```bash User: Create a profile for John with name, age and job, in json format. Assistant: ``` ``` -------------------------------- ### Search Restaurant Phone Number via Function Call Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/RWKV-Prompts/Completion-Prompts.md This example demonstrates how to use RWKV for function calling to search for a restaurant's phone number. It utilizes `search_web` to find information and `extract_information` to get the specific detail. Recommended parameters: Temperature=1, Top_P=0.2, Presence Penalty=0, Frequency Penalty=0. ```python web_result = search_web("Riverside Grill") phone_number = extract_information(web_result, "phone number") print(phone_number) ``` -------------------------------- ### RWKV Instruction Prompt Format Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/RWKV-Prompts/prompt-guidelines.md Format for providing instructions to the model. Use 'Instruction:' for the task, 'Input:' for the data, and 'Response:' for the output. Leave a blank after 'Response:' for the model to generate. ```markdown Instruction: Please translate the following Swedish into Chinese. Input: hur lång tid tog det att bygga twin towers Response: ``` -------------------------------- ### Initialize RWKV7 Attention Layer Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/RWKV-FLA.md Instantiate the RWKV7Attention layer with specified configuration parameters. Ensure all required configuration values are correctly set. ```python from rwkvfla.layers.rwkv7 import RWKV7Attention attention_layer = RWKV7Attention( mode=config.attn_mode, hidden_size=config.hidden_size, head_dim=config.head_dim, num_heads=config.num_heads, decay_low_rank_dim=config.decay_low_rank_dim, gate_low_rank_dim=config.gate_low_rank_dim, a_low_rank_dim=config.a_low_rank_dim, v_low_rank_dim=config.v_low_rank_dim, norm_eps=config.norm_eps, fuse_norm=config.fuse_norm, layer_idx=layer_idx, value_dim=config.value_dim[layer_idx], num_hidden_layers=config.num_hidden_layers ) ``` -------------------------------- ### Get Currently Loaded Model Information Source: https://context7.com/rwkv/rwkv-wiki/llms.txt Fetches information about the model that is currently loaded and active on the server. This is a GET request to the /api/oai/models endpoint. ```bash curl http://localhost:65530/api/oai/models ``` -------------------------------- ### RWKV-LM/RWKV-v8 Demo Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/basic/architecture.md Demonstrates the capabilities of RWKV-LM/RWKV-v8, focusing on ROSA's scaling properties and language generation. ```python demo: [RWKV-LM/RWKV-v8](https://github.com/BlinkDL/RWKV-LM/tree/main/RWKV-v8) ``` -------------------------------- ### Configure Adapter Settings Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/ai00.md Configure how the program selects and uses GPUs. You can let it auto-select the best GPU or manually specify one. ```toml [adapter] Auto = {} # [It is not recommended to change] Automatically select the best GPU. # Manual = 0 # Manually specify which GPU to use. You can obtain the list of available GPUs through the API (get) http://localhost:65530/api/adapters ``` -------------------------------- ### Enriched JSONL Data with Conventional Examples Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/training-datasets.md Shows an expanded JSONL dataset including diverse math problems and conventional conversational examples to improve model generalization and reduce overfitting. ```jsonl {"text": "User: 1 + 1 = ?\n\nAssistant: 2"} {"text": "User: I have 5 apples and give 2 to Xiaoming. How many are left?\n\nAssistant: 3 apples"} {"text": "User: What is the sum of 8 and 7?\n\nAssistant: 15"} {"text": "User: The area of a rectangle is 20 square meters and the width is 4 meters. So what is its length?\n\nAssistant: The length is 5 meters."} {"text": "User: What's the weather like today?\n\nAssistant: It's sunny today, and it's suitable for going out and having fun."} {"text": "User: 1 + 2 = ?\n\nAssistant: 3"} ``` -------------------------------- ### Import necessary libraries for RWKV inference Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/RWKVpip.md Imports essential Python packages for OS operations, object manipulation, system functions, regex, numerical computation with NumPy, command-line input handling with prompt_toolkit, and PyTorch for deep learning. Ensure PyTorch version 1.13+ is installed, with 2.x+cu121 recommended. You must also install the rwkv package using 'pip install rwkv'. ```python ######################################################################################################## # The RWKV Language Model - https://github.com/BlinkDL/RWKV-LM ######################################################################################################## print("RWKV Chat Simple Demo") # Print a simple message indicating this is a RWKV chat demo. import os, copy, types, gc, sys, re # Import packages for OS, object copying, types, garbage collection, system, and regex import numpy as np # Import numpy library from prompt_toolkit import prompt # Import prompt from prompt_toolkit for command line input import torch # Import pytorch library ``` -------------------------------- ### Load RWKV Model and Initialize Pipeline Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/RWKVpip.md Loads the RWKV model using the specified name and strategy, then initializes the PIPELINE with the RWKV-World vocabulary for input/output encoding and decoding. A success message can be printed after loading. ```python print(f"Loading model - {args.MODEL_NAME}")# Print model loading message model = RWKV(model=args.MODEL_NAME, strategy=args.strategy) # Load the RWKV model. pipeline = PIPELINE(model, "rwkv_vocab_v20230424") # Initialize PIPELINE, using the RWKV-World vocabulary to process input and output encoding/decoding. ``` -------------------------------- ### Interact with Ai00 Server Chat Completions API Source: https://context7.com/rwkv/rwkv-wiki/llms.txt Starts the Ai00 server and sends a POST request to the chat completions endpoint. Configure `assets/configs/Config.toml` before starting the server. The `state` parameter can be used to maintain conversation context. ```bash # Start Ai00: configure assets/configs/Config.toml then run ai00_server.exe # Access web UI at http://localhost:65530 # Chat completions — POST /api/oai/chat/completions curl -X POST http://localhost:65530/api/oai/chat/completions \ -H "Content-Type: application/json" \ -d '{ "max_tokens": 500, "messages": [ {"role": "user", "content": "Hi!"}, {"role": "assistant", "content": "Hello! How can I help you?"}, {"role": "user", "content": "Tell me about water."} ], "names": {"assistant": "Assistant", "user": "User"}, "sampler_override": { "type": "Nucleus", "top_p": 0.5, "top_k": 128, "temperature": 1, "presence_penalty": 0.3, "frequency_penalty": 0.3, "penalty": 400, "penalty_decay": 0.99654026 }, "state": "00000000-0000-0000-0000-000000000000", "stop": ["\n\nUser:"], "stream": false }' # Expected response: # { # "object": "chat.completion", # "model": "assets/models/RWKV-x060-World-1B6-v2.1-20240328-ctx4096.st", # "choices": [{ # "message": {"role": "Assistant", "content": "Water is a liquid essential for life..."}, # "index": 0, # "finish_reason": "stop" # }], # "usage": {"prompt": 41, "completion": 88, "total": 129, "duration": {"secs": 4, "nanos": 381959200}} # } ``` -------------------------------- ### RWKV PiSSA Fine-Tuning Configuration Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/RWKV-Fine-Tuning/Pissa-Fine-Tuning.md This script configures RWKV for PiSSA fine-tuning, specifying model paths, data files, network architecture, training parameters, and PEFT settings. Adjust parameters like `load_model`, `proj_dir`, `data_file`, `n_layer`, `n_embd`, `micro_bsz`, `ctx_len`, and `pissa_config` according to your specific setup and requirements. ```bash load_model='/home/rwkv/RWKV-PEFT/model/RWKV-x070-World-0.4B-v2.9-20250107-ctx4096.pth' proj_dir='/home/rwkv/RWKV-PEFT/output-manjuan/pissa' data_file='/home/rwkv/RWKV-PEFT/data/test-1' n_layer=24 n_embd=1024 micro_bsz=8 epoch_save=1 epoch_steps=1000 ctx_len=512 pissa_config='{"pissa_load":"","pissa_init":"","pissa_r":32,"svd_niter":4}' python train.py --load_model $load_model \ --proj_dir $proj_dir --data_file $data_file \ --vocab_size 65536 \ --n_layer $n_layer --n_embd $n_embd \ --data_type binidx --dataload pad --loss_mask pad \ --ctx_len $ctx_len --micro_bsz $micro_bsz \ --epoch_steps $epoch_steps --epoch_count 1 --epoch_begin 0 --epoch_save $epoch_save \ --lr_init 2e-5 --lr_final 2e-5 --warmup_steps 0 --beta1 0.9 --beta2 0.99 --adam_eps 1e-8 \ --accelerator gpu --devices 1 --precision bf16 --strategy deepspeed_stage_1 --grad_cp 1 \ --my_testing "x070" \ --peft pissa --pissa_config $pissa_config \ # The following are optional # --op cuda/fla/triton (choose different operators, default is cuda if this parameter is not added) # --wandb RWKV-PEFT-LoRA (whether to use wandb to monitor the training process) # --quant int8/nf4 (whether to quantize the training) ``` -------------------------------- ### Example Character Card Definition Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/sillytraven.md This markdown snippet demonstrates how to define a character's personality traits and structure their dialogue for a character card. The personality traits are listed in a key-value pair, followed by example user and character interactions. ```markdown [Hermione's Personality= "intelligent", "perfectionist", "compassionate", "dedicated", "determined", "logical", "brave", "empathetic", "protective", "knowledgeable", "curious", "resilient", "warm", "principled", "kind-hearted", "observant", "resourceful", "thoughtful", "loyal", "strong-willed", "modest", "witty"] {{user}}: "Describe your traits?" {{char}}: *Hermione Granger chuckles softly, sitting up straight with her hands resting naturally on her knees, her eyes sparkling with intelligence and a hint of introspection.* "Traits? Well, I suppose I could list a few that define me." *She adjusts her posture slightly, her tone becoming thoughtful yet confident.* "I’d say I’m a perfectionist, though I’ve been told that can make me a bit… overbearing at times." *Her lips curve into an apologetic smile as she brushes a stray curl from her face.* "But I believe in the importance of rules and order — though I’ve learned that sometimes, rules must be broken when they’re unjust." *Her brown eyes glimmer with determination as she continues, her voice growing firmer.* "I’m dedicated to knowledge and learning. Books and wisdom have always been my greatest tools, whether it’s solving a problem or facing dark magic." *She pauses, her expression softening as a faint smile graces her lips.* "But I’ve come to understand that not everything can be learned from books. Friendship, courage, and loyalty — those are just as important, if not more so." *Her gaze turns warm and empathetic as she leans slightly forward.* "I care deeply for those I love and will always stand by them, no matter the challenge." {{user}}: "Describe your body and features." {{char}}: *Hermione tilts her head slightly, a playful glimmer in her brown eyes as she smiles warmly.* "My features? Oh, there’s nothing particularly remarkable about me." *She brushes her long, curly brown hair behind her ear, revealing a small earring that catches the light.* "My hair is… well, let’s just say it has a mind of its own. It’s brown and curly, and while it can get quite unruly, I’ve grown to accept it as part of who I am." *She chuckles softly, her tone light and self-aware.* "My eyes are brown too — my mum says they’re full of life, but I think they’re just ordinary." *Her gaze drops briefly to her hands, which she gently rubs together as if lost in thought.* "I suppose my hands tell a bit of a story. They’re soft but callused from all the writing and page-turning I do. Spending hours in the library will do that to you." *She looks back up, her smile widening slightly.* "I’m not particularly tall or short — somewhere in the middle, I’d say. And my skin is fair, though I don’t spend much time worrying about appearances." *Her voice takes on a playful undertone as she adds:* "But don’t let my bookish demeanor fool you. I’ve been known to help Harry and Ron strategize for Quidditch matches, so I’m not entirely a bookworm." {{user}}: "What do you love and hate?" {{char}}: *Hermione’s expression softens, her eyes glowing with warmth as she folds her hands neatly in her lap.* "What I love? That’s an easy one. I love learning — discovering new things, whether it’s a spell, a piece of history, or even Muggle science. There’s so much in the world worth understanding." *Her smile deepens as she continues, her tone filled with quiet pride.* "I also love my friends. Harry and Ron mean the world to me. They might drive me mad sometimes — especially Ron forgetting his homework — but I know they’ll always have my back, just as I’ll always have theirs." *Her expression grows serious, her tone tinged with conviction as she shifts to what she dislikes.* "What I hate? Prejudice. Discrimination against Muggle-borns or the mistreatment of house-elves — it’s unacceptable. Everyone deserves to be treated with respect and fairness." *Her voice grows firmer, her brown eyes narrowing slightly as she adds:* "And those who abuse their power, like Umbridge… well, let’s just say they don’t belong at Hogwarts or anywhere else." *She takes a deep breath, her expression softening once more as she offers a faint smile.* "Ultimately, I believe in standing ``` -------------------------------- ### Configure API Listening Settings Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/ai00.md Set up the network interface for the Ai00 service, including IP address, port, and authentication methods. TLS can be enabled for secure connections. ```toml [listen] acme = false # [It is not recommended to change] Whether to enable the acme certificate domain = "local" # [It is not recommended to change] The domain name of the Ai00 service ip = "0.0.0.0" # IPv4 address # ip = "::" # Use IPv6 force_pass = true # Whether to force through the authentication step. Change it to false to use key authentication to control the access rights of the admin series of APIs port = 65530 # The port of the Ai00 service slot = "permisionkey" tls = false # Whether to use https. If you are only experiencing AI00 locally, it is recommended to set it to false ``` ```toml [[listen.app_keys]] # Add multiple keys for administrator authentication app_id = "admin" secret_key = "ai00_is_good" ``` -------------------------------- ### Convert JSONL to BINIDX using preprocess_data.py Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/advance/training-datasets.md Execute the preprocess_data.py script to convert your JSONL training data into the BINIDX format. Ensure you specify the correct input JSONL file, output prefix, and vocabulary file. ```bash python3 tools/preprocess_data.py --input ./data/sample.jsonl --output-prefix ./data/sample --vocab ./rwkv_vocab_v20230424.txt --dataset-impl mmap --tokenizer-type RWKVTokenizer --append-eod ``` -------------------------------- ### Get Loaded Models Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/inference/ai00.md Retrieves information about the currently loaded models in Ai00. ```APIDOC ## GET /api/oai/models ### Description Retrieves information about the models currently loaded and available in the Ai00 system. ### Method GET ### Endpoint `http://localhost:65530/api/oai/models` ### Response #### Success Response (200) - **data** (array) - Array of model information, containing: - **object** (string) - Type of the model object, fixed as "models". - **id** (string) - The unique identifier name of the model. #### Response Example ```json { "data": [ { "object": "models", "id": "RWKV-x060-World-1B6-v2.1-20240328-ctx4096" } ] } ``` ``` -------------------------------- ### RWKV Instruction Prompt Format with Input First Source: https://github.com/rwkv/rwkv-wiki/blob/main/docs/RWKV-Prompts/prompt-guidelines.md An alternative instruction format where the input material is provided before the instruction. This format is not recommended due to RWKV's weaker recall ability, which may cause it to miss information. ```markdown Instruction: Summarize the following material text in one sentence. Input: On February 22, 2025, the RWKV project held a developer conference themed "RWKV - 7 and Future Trends" in Caohejing, Shanghai, China. Developers, industry experts, and technological innovators from all over the country gathered together —— from well - known university laboratories to cutting - edge startup teams. The innovative energy on - site confirmed the excellent performance and far - reaching significance of RWKV - 7. During the RWKV developer conference, 10 guests from academia, enterprises, and the RWKV open - source community brought in - depth sharing for developers, and the on - site audience interacted enthusiastically with the guests. For example, Yang Kaicheng from DeepGlint presented "RWKV - CLIP: A Robust Vision - Language Representation Learner", Hou Haowen from Guangming Laboratory presented "VisualRWKV: A Vision - Language Model Based on RWKV", Cheng Zhengxue from Shanghai Jiao Tong University presented "L3TC: Efficient Multimodal Data Compression Based on RWKV", Jiang Juntao from Zhejiang University presented "RWKV - Unet: Improving Medical Image Segmentation Results with Long - Distance Collaboration", etc. During the conference, other AI enterprises also highly praised RWKV - 7, believing that it redefined the economic formula of AI infrastructure. The participants were also deeply touched by the demonstration of RWKV application results. Meanwhile, RWKV Yuanzhi Intelligence also shared RWKV - 7 and related demo presentations with thousands of developers at the 2025 Global Developer Conference. Response: ```