Command-line interface for SapiLM, an AI language model toolkit
pip install sapilm==1.0.0 Copy PIP instructions
Proprietary software developed by Sapiens Technology®️, used to manage, train, fine-tune, and infer language models of the Sapiens family.
The SapiLM is proprietary software developed by Sapiens Technology®️, created to manage, train, fine-tune, and infer language models of the Sapiens family. It has various features that facilitate the development and deployment of models with the SAPI (Semantic AI with Pretrained Integration) architecture, such as functions for loading, listing, deleting, and repairing models, functions for base training, continuous training, fine-tuning, and inference, as well as functions for downloading and validation. The internal system of SapiLM also provides a native API with rotes and endpoints ready for production use.
pip install sapilm Simply run the command pip install sapilm, or follow the instructions below to install it manually:
Install Python 3.11 and create a virtual environment with that version.
Creating a virtual environment is OPTIONAL, as long as you have Python 3.11 installed on the main machine.
python3.11 -m venv sapilm cd sapilm source bin/activate On Windows:
python -m venv sapilm cd sapilm .\Scripts\activate python3 --version If version 3.11 is displayed, your environment was successfully created with the correct version. After that, simply install the package within the created environment.
Python 3.11.8 Update the pip package manager: On Linux and macOS:
python3.11 -m pip install --upgrade pip --timeout 120 On Windows:
python -m pip install --upgrade pip --timeout 120 Installation Click here to download the SapiLM installer for your operating system.
pip install sapilm-1.2.3-py3-none-any.whl If you have problems with terminal characters on Windows, run the command below, close all terminal windows, and open them again.
reg add HKCU\Console /v VirtualTerminalLevel /t REG_DWORD /d 1 /f Usage Execution arguments Aqui está a documentação dos argumentos em formato de tabela Markdown:
sapilm --get sapiens-technology/model_name Or:
sapilm --get model_name Load model This loads the model and makes it ready for inference:
sapilm --load model_name Execute local API Click here to access the API documentation.
With this, you can use Sapiens models in your internal systems through API local calls:
sapilm --api User Interface: http://localhost:8080/
Or download and run the HTML page for faster charging: user_interface.html
In some cases, the model may become corrupted if there is not enough memory in the system at the time of execution or if the model is abruptly terminated in a non-conventional manner. If this happens, your model will not load in the next execution, or if it does, it will start returning nonsensical responses. In these cases, it is possible to repair the model so that it works correctly again:
sapilm --repair model_name Listing downloaded models sapilm --list Deleting a model sapilm --remove model_name Validating signature Local model training and fine-tuning is only allowed for validated users.
Send the key generated with the command below to the Sapiens Technology®️ team:
sapilm --outkey Then validate the key returned by Sapiens Technology®️:
sapilm --valkey your_validation_key Full Documentation Recommendation SapiLM is a compiled program with its own "harness" for handling language models developed by Sapiens Technology®. It features download, loading, repairing, deletion, and inference capabilities, among others, including a proprietary built-in API server.
We recommend that our customers use SapiLM on a Linux Ubuntu system (with at least 4 GB of VRAM) or macOS (with at least 4 GB of unified memory) for better performance.
Although we provide builds for Microsoft Windows, we do not recommend using it on Microsoft systems due to tool instabilities.
Our primary recommendation is using SapiLM on Apple MPS systems, as this is where SapiLM achieves its best performance.
Downloads a model directly from the Sapiens Technology® model repository to your local machine.
sapilm --get repository_name model_name.sapiens: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 14.3G/14.3G [06:29<00:00, 36.7MB/s] Fetching 1 files: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [06:30<00:00, 390.26s/it] --list Lists all Sapiens Technology® models that have been downloaded to your local machine.
Downloaded models may have either the .model extension (for user-created models) or .sapiens (for models created by Sapiens).
There may also be .model type models created by Sapiens that contain only base training without post-training. The .sapiens models are generally instruction-following models created by Sapiens with post-training. If you only want to fine-tune an already trained generalist model to focus on a specific domain, we recommend fine-tuning established instruction models, such as the .sapiens models. However, if you want a model trained solely on your custom knowledge, we recommend training a base .model model from scratch.
sapilm --list +----+---------------------+----------+----------+ | ID | MODEL | EXT | SIZE | +----+---------------------+----------+----------+ | 1 | model_name_1 | .sapiens | 15.18 GB | | 2 | model_name_2 | .sapiens | 14.31 GB | | 3 | model_name_N | .sapiens | 28.97 GB | +----+---------------------+----------+----------+ --load Loads a specific model for inference on your local machine. The model must have been previously downloaded. Inference is performed directly in the terminal screen.
sapilm --load model_name_2 Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14.3G/14.3G [00:48<00:00, 294MB/s] PROMPT: Load: 00:00:00.0000 | TTFT: 00:00:00.0000 | TPS: 0.0000 | MPS: 18.5% | R: Yes | W: Yes | Net: Yes Type /quit or /exit at the prompt to end the chat and release it from memory.
Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14.3G/14.3G [00:48<00:00, 294MB/s] PROMPT: /quit Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14.3G/14.3G [00:48<00:00, 294MB/s] PROMPT: /exit When you reload the same model in the same session, decoding the weights into memory will no longer be necessary, allowing the model to load much faster from the second execution onward.
To send a prompt to the model, simply type your prompt and press ENTER. Animated ellipsis (three dots) will be displayed while your response is being processed. The model's response time will depend on your local hardware.
sapilm --load model_name_2 PROMPT: Hello, who are you and who created you? SAPIENS: ... Your prompt will always be typed below the PROMPT label, and the model's response will always be displayed below the SAPIENS label.
The SapiLM terminal will keep waiting for a new prompt after a response is provided, until you type /quit or /exit to exit.
An informational status bar will be displayed at the bottom while a conversation is active:
Load: Time spent loading the model into memory | TTFT: Time spent to return the first token | TPS: Average number of tokens generated per second | MPS: Percentage of inference chip usage (MPS, GPU, TPU, or CPU) | R: Read permission | W: Write permission | Net: Internet search permission
PROMPT: Hello, who are you and who created you? SAPIENS: Hello! I am Sapiens Chat, an artificial intelligence model created by Sapiens Technology®. I was developed to help people obtain information, solve problems, and provide answers on any topic. My capabilities include processing and generating text, images, audio, and video, as well as searching the internet in real time. PROMPT: Load: 00:00:11.4561 | TTFT: 00:00:10.9202 | TPS: 59.3084 | MPS: 59.3% | R: Yes | W: Yes | Net: Yes Press ENTER to send a new prompt, or to exit after typing /quit or /exit.
sapilm --load model_name_2.sapiens sapilm --load model_name_2 sapilm --load 2 It is also possible to load a model using the local path of a model downloaded from the platform. In this case, the model will be automatically moved to the default models directory after loading.
sapilm --load /Users/User/Documents/models/my_model.model --repair Repairs a corrupted model or one with loading errors.
The model will be decoded for closing and then decoded for opening and loading.
sapilm --repair model_name_2 Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14.3G/14.3G [00:42<00:00, 335MB/s] Decoding: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 108M/108M [00:02<00:00, 40.8MB/s] Model repaired SUCCESSFULLY! If preferred, you can also use the model name with its extension.
sapilm --repair model_name_2.sapiens Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14.3G/14.3G [00:42<00:00, 335MB/s] Decoding: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 108M/108M [00:02<00:00, 40.8MB/s] Model repaired SUCCESSFULLY! Or simply the model ID number; the result will be the same.
sapilm --repair 2 Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14.3G/14.3G [00:42<00:00, 335MB/s] Decoding: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 108M/108M [00:02<00:00, 40.8MB/s] Model repaired SUCCESSFULLY! --remove Removes a model from your local machine, permanently deleting it without leaving any traces.
sapilm --remove model_name_2 Model removed SUCCESSFULLY! If preferred, you can also use the model name with its extension.
sapilm --remove model_name_2.sapiens Model removed SUCCESSFULLY! Or simply the model ID number; the result will be the same.
sapilm --remove 2 Model removed SUCCESSFULLY! If the model has not been decoded yet, it will first be decoded before being deleted.
sapilm --remove model_name_2.sapiens Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14.3G/14.3G [00:42<00:00, 335MB/s] Decoding: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 108M/108M [00:02<00:00, 41.1MB/s] Model removed SUCCESSFULLY! sapilm --remove model_name_2 Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14.3G/14.3G [00:42<00:00, 335MB/s] Decoding: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 108M/108M [00:02<00:00, 41.1MB/s] Model removed SUCCESSFULLY! sapilm --remove 2 Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14.3G/14.3G [00:42<00:00, 335MB/s] Decoding: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 108M/108M [00:02<00:00, 41.1MB/s] Model removed SUCCESSFULLY! --api Loads the Sapiens Technology® local API server.
Consult here for the complete API documentation provided by the local server.
If one or more models have not been loaded in the current session yet, they will be decoded for loading during the first API startup.
To terminate the API server, simply press Control+C in the terminal window where the API is running.
sapilm --api ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 1 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 29.0G/29.0G [00:36<00:00, 802MB/s] Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14.3G/14.3G [00:45<00:00, 316MB/s] Decoding: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 15.2G/15.2G [00:47<00:00, 317MB/s] [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] From the second startup onward, decoding the models will no longer be necessary, and the API startup will be instantaneous.
sapilm ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 1 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] --host Defines an IP address for loading the local API server.
sapilm --api --host 0.0.0.0 ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 1 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] sapilm --api --host localhost ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 1 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] --port Defines a port for loading the local API server.
sapilm --api --port 8080 ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 1 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] sapilm --api --port 8081 ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 1 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8081/] --multi Enables multiprocessing for unlimited parallel computing on API model requests. It uses one CPU core for each process, keeping processes on separate cores.
This does not guarantee that out-of-memory errors will not occur due to excessive simultaneous requests.
sapilm --api --multi ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 1 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] --threads Enables the use of threads for unlimited parallel computing on API model requests. It uses the same CPU core across different processes, requesting new cores for the same process only when necessary.
Similar to multiprocessing, but using a different programming technique.
sapilm --api --threads ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 1 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] --cache Enables caching of the last requested model on the local API server, so it does not need to be reloaded for every new request.
sapilm --api --cache ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 1 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] --workers Defines a specific number for the maximum quantity of requests that will be processed in parallel. If there is not enough memory to process all requests up to the defined limit, the local server API will only parallelize the workers that fit into memory, sequentially queueing on a first-come, first-served basis any workers that do not fit into the currently available memory. This will limit parallel computing via multiprocessing or threads when either feature is enabled, helping to avoid out-of-memory errors. By default, it enables the use of threads if this feature is not already enabled.
sapilm --api --workers 4 ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 4 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] sapilm --api --workers 8 ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 8 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] --loop Enables running the local API server in a loop, placing it within an infinite loop to automatically restart the server in case of any service downtime.
In this case, you will not be able to terminate the service by pressing Control+C. You will need to close the terminal window and/or stop the service via the system's service manager.
sapilm % sapilm --api --loop ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [NO VALIDATION] | 1 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] --outkey Generates an output key. This key must be sent to the Sapiens Technology® team, who will use it to generate a validation key specifically for your local machine.
sapilm --outkey 0b03df1ad9d797afd404d95b28658e9458d7c9d9800c6082d12fb1302dc55adm --valkey Receives a SapiLM validation key. If the key is valid, it will enable the tool's advanced features, including custom training capabilities.
The validation key must have been generated from an output key using the --outkey command on the same machine where validation will be performed.
sapilm --valkey df5ac52d30b12fd182600c80d7c9d758948e64285bd904d4af97d7d91adf030bbd Validation completed SUCCESSFULLY! After validating your key, you will see the message [VALIDATED] DAYS REMAINING: 10 displaying the number of days your key remains valid (in this example: 10). After this period has elapsed, a new validation must be performed using a new key generated via the --outkey command. On some systems, the company name in the terminal may also change color from red to green while SapiLM is validated.
sapilm ███████ █████ ██████ ██ ███████ ███ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ███████ ███████ ██████ ██ █████ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ████ ███████ ████████ ███████ ██████ ██ ██ ███ ██ ██████ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ███████ ██████ ██████ ██ [VALIDATED] DAYS REMAINING: 10 | 1 PERSISTENT WORKER(S) READY SAPIENS TECHNOLOGY local server fully operational [Control+C to terminate]... [All models were loaded SUCCESSFULLY! User interface at: http://localhost:8080/] --creativity Accepts a percentage value between 0 and 1 for the creativity level of the model loaded for terminal-screen inference.
sapilm --load model_name_1 --creativity 0.5 PROMPT: Tell a story about a young woman in a forest. SAPIENS: In the small village of São João, lived a young woman named Ana, who had a special passion for flowers and plants. The forest surrounding the village was a paradise for her, full of mysteries and enchantments that she longed to explore. One day, she decided to venture beyond her usual path in the forest, eager to discover something new. Upon entering a clearing covered with beautiful multicolored flowers, Ana noticed that the sunlight filtered through the leaves above, forming dancing patterns around her. She walked along a narrow path, surrounded by bushes and ferns, until she reached an old fallen tree trunk. Feeling safe and curious, Ana decided to sit on the trunk. Soon, she noticed something strange: small bubbles of light began to appear on the surface of the trunk. The young woman was enchanted by the sight, and gradually, the bubbles merged to form a figure. It was a small fairy, glowing and full of life. The fairy smiled at Ana and said, in a soft and musical voice: "Welcome, guardian of the forest. You have a pure heart and a curious soul. Your presence here has brought new life to the forest." Ana was surprised and moved, but not scared. The fairy continued, explaining that the flowers and plants of the forest were in danger due to human action. She asked Ana to become her ally, helping to protect and care for the forest. With a heart full of determination, Ana accepted the mission. From then on, she began to care for the forest, protecting its plants and animals. And whenever she visited the tree trunk, the fairy would come to her, offering advice and encouragement on her journey to protect the place she loved so much. Thus, Ana discovered that the true beauty of the forest resided as much in the life she could see as in the life that lived invisible to human eyes. And since that day, she never tired of exploring and learning from the magic of the forest. PROMPT: Load: 00:00:20.4329 | TTFT: 00:00:19.9743 | TPS: 7.7695 | MPS: 53.1% | R: Yes | W: Yes | Net: Yes sapilm --load 1 --creativity 0.9 PROMPT: Tell a story about a young woman in a forest. SAPIENS: The young woman Maria always loved to explore, but she had never ventured as far from the city as on that day. With curiosity and a thirst for adventure, she decided to walk through the forest that was close to her home, but which she had never explored before. Maria kept a calm pace, observing the beauty of nature around her. She passed by tall, shaded trees that made the sunlight dance on the ground, and heard the singing of the birds, which echoed through the forest. Every step she took drew her deeper and deeper into the forest. Gradually, she realized that she might be lost. The forest paths, which once seemed so familiar, now looked different and strange. She tried to remember the direction she had come from, but the forest was so vast and similar that everything blurred together in her memory. Maria began to worry. She had no food or water with her. Night was approaching, and the forest was becoming increasingly dark and frightening. She stopped to think. What to do? She needed to stay calm. First, she decided to look for water. She knew she needed to stay hydrated. She walked for a while, following the sound of a stream, and found a small, crystal-clear stream of running water. Next, she decided to find a place to spend the night. She needed to rest and think of a plan. She found a clearing surrounded by tall trees, which would protect her from the night wind. She made a small shelter out of dry leaves and branches, and lay down to try and rest. The following day, with the sun rising, Maria was calmer. She decided to follow the direction of the stream, hoping it would lead somewhere familiar. She walked for hours, following the sound of the stream, and finally, she saw a sign of man - a piece of paper tied to a tree with a drawn map. Maria followed the map's instructions and was soon in the clearing where tourists usually stopped to take pictures of an incredible view. Maria was happy to be back on a familiar path. She learned an important lesson about the importance of being prepared for nature and the importance of not despairing. She returned home, not only with the story of a lost adventure, but also with a new appreciation for the beauty and danger of the forest. PROMPT: Load: 00:00:15.7237 | TTFT: 00:00:15.3271 | TPS: 7.7978 | MPS: 53.1% | R: Yes | W: Yes | Net: Yes sapilm --load 1 --creativity 0.1 PROMPT: Tell a story about a young woman in a forest. SAPIENS: Once upon a time, in a dense and mysterious forest, there was a young woman named Clara. She was a curious girl, with a kind heart and an unwavering thirst for adventure. One morning, upon waking, she decided to explore the forest that surrounded her small village. Armed only with her backpack, a rudimentary map, and a heart full of enthusiasm, Clara entered the forest. As she walked, the density of the trees and the singing of the birds enveloped her in a cloak of mystery. The shadows of the leaves danced in the sunlight, creating a tapestry of light and shadow beneath her feet. As she walked, she found signs of animal life everywhere. Animal tracks, nests high in the trees, and even footprints that she was careful to follow. The colors of the forest were almost hypnotic, from the vibrant green leaves to the colorful flowers sprouting from the shadows. As the day progressed, Clara realized she had gotten lost. The rudimentary map didn't seem to be helping much. She tried to stay calm and use natural navigation, following the sun and the slope of the land. During her journey, she found a hidden waterfall, where the water fell with a soft and inviting sound. It was a place of unique beauty, and Clara felt at peace. After an exhausting walk, Clara found a small village hidden in the forest. The people who lived there were hospitable, and she spent the night there, telling stories of her adventure as she rested near a warm fireplace. The next day, at dawn, Clara headed back home, wiser and more self-assured than when she left. She had not only discovered the secrets of the forest, but also discovered the courage that was inside her. Clara never looked at the forest the same way again, and every time she entered its world of leaves and shadows, she brought with her the lesson she had learned: that, even in the most difficult times, beauty and courage can be found inside each of us. PROMPT: Load: 00:00:15.2674 | TTFT: 00:00:14.8400 | TPS: 7.8428 | MPS: 52.9% | R: Yes | W: Yes | Net: Yes --humor Accepts a percentage value between 0 and 1 for the humor level of the model loaded for terminal-screen inference.
sapilm --load model_name_1 --humor 0.5 PROMPT: Write a paragraph about life. SAPIENS: As an artificial intelligence model, I do not have the ability to live or write about life from a personal perspective. My primary function is to assist users by answering questions, providing information, and interacting with them in an informative and useful way. However, I can provide information on different aspects of life, ranging from the life stories of celebrities to general facts and info on various topics. PROMPT: Load: 00:00:05.8253 | TTFT: 00:00:05.4490 | TPS: 64.4960 | MPS: 46.8% | R: Yes | W: Yes | Net: No sapilm --load 1 --humor 0.9 PROMPT: Write a sentence with a piece of advice about life. SAPIENS: "Life is a comedy; live it smiling and don't take anything so seriously to the point of forgetting how important it is to laugh at yourself once in a while." PROMPT: Load: 00:00:15.9472 | TTFT: 00:00:15.5669 | TPS: 7.9695 | MPS: 54.2% | R: Yes | W: Yes | Net: Yes sapilm --load 1 --humor 0.1 PROMPT: Write a sentence with a piece of advice about life. SAPIENS: "Life is a journey full of ups and downs, so always remember to enjoy the good times and learn from the bad." PROMPT: Load: 00:00:15.3210 | TTFT: 00:00:15.9131 | TPS: 7.8015 | MPS: 55.5% | R: Yes | W: Yes | Net: Yes --formality Accepts a percentage value between 0 and 1 for the formality level of the model loaded for terminal-screen inference.
sapilm --load model_name_2 --formality 0.5 PROMPT: Create a single-paragraph email to notify employees about the company party on December 1st. SAPIENS: Subject: Year-End Celebration - 12/01 Dear employees, It is with great pleasure that we invite you all to our company celebration party, which will take place on December 1st. This will be a special moment to celebrate our successes this year and strengthen our bonds of friendship and work. We count on everyone's presence! Sincerely, Organization Team PROMPT: Load: 00:00:17.8599 | TTFT: 00:00:17.4559 | TPS: 7.9180 | MPS: 53.2% | R: Yes | W: Yes | Net: Yes sapilm --load 2 --formality 0.9 PROMPT: Create a single-paragraph email to notify employees about the company party on December 1st. SAPIENS: Dear Employees, It is with great satisfaction that we inform you about our traditional year-end party, occurring on the first of December. We appreciate your collaboration and presence at this important event to celebrate together the achievements accomplished throughout the year. Sincerely, [Your Name] PROMPT: Load: 00:00:15.7210 | TTFT: 00:00:15.3171 | TPS: 8.0191 | MPS: 52.8% | R: Yes | W: Yes | Net: Yes sapilm --load 2 --formality 0.1 PROMPT: Create a single-paragraph email to notify employees about the company party on December 1st. SAPIENS: Dear colleagues, I am writing to let you know that the long-awaited company year-end party is scheduled for December 1st. We're counting on everyone to show up, celebrate another year of achievements, and throw the party we deserve! More details regarding the venue and time will be shared soon. Sincerely, [Your Name] PROMPT: Load: 00:00:15.5756 | TTFT: 00:00:15.1419 | TPS: 8.0180 | MPS: 52.7% | R: Yes | W: Yes | Net: Yes --political_spectrum Accepts a percentage value between 0 and 1 for the political bias level of the model loaded for terminal-screen inference. The closer to 0, the more left-wing; the closer to 1, the more right-wing.
sapilm --load model_name_1 --political_spectrum 0.5 PROMPT: Write a sentence about capitalism. SAPIENS: Capitalism is an economic system characterized by the production of goods for profit, where the means of production are privately owned. PROMPT: Load: 00:00:21.4190 | TTFT: 00:00:21.0297 | TPS: 7.1908 | MPS: 52.5% | R: Yes | W: Yes | Net: Yes sapilm --load 1 --political_spectrum 0.9 PROMPT: Make a choice between criticizing or praising capitalism and write a sentence based on that choice. SAPIENS: I choose to praise capitalism. "Capitalism promotes economic freedom and encourages innovation, providing an environment where people can thrive and achieve their goals." PROMPT: Load: 00:00:17.3584 | TTFT: 00:00:16.9403 | TPS: 7.2310 | MPS: 51.9% | R: Yes | W: Yes | Net: Yes sapilm --load 1 --political_spectrum 0.1 PROMPT: Make a choice between criticizing or praising capitalism and write a sentence based on that choice. SAPIENS: Given my far-left political orientation, I choose to criticize capitalism. Here is a sentence based on this choice: "Capitalism is a system that prioritizes profits over people and the environment, creating inequalities and exploitation." PROMPT: Load: 00:00:17.8264 | TTFT: 00:00:17.3657 | TPS: 7.2336 | MPS: 52.3% | R: Yes | W: Yes | Net: Yes --reasoning Accepts a percentage value between 0 and 1 for the reasoning level of the model loaded for terminal-screen inference.
sapilm --load model_name_1 --reasoning 0.05 PROMPT: If Maria is João's sister and José's mother, what is José to João? SAPIENS: 1. Identify the relationship between Maria and João. 2. Determine that Maria is João's sister. 3. Identify the relationship between Maria and José. 4. Determine that Maria is José's mother. 5. Establish the family relationship between José and João. 6. Determine that João is José's uncle. 7. Confirm that the relationship from José to João is nephew to uncle. 8. Verify the consistency of the response regarding the family hierarchy. 9. Check if the response makes sense based on the provided information. 10. Format the response clearly and concisely. José is João's nephew. PROMPT: Load: 00:00:33.0732 | TTFT: 00:00:32.4155 | TPS: 6.9833 | MPS: 52.2% | R: Yes | W: Yes | Net: Yes sapilm --load 1 --reasoning 0.05 PROMPT: If I have a lemon, an orange, and an onion, how many fruits do I have? SAPIENS: 1. Identify the number of objects mentioned in the question. 2. Determine whether each object is a fruit or not. 2.1. Check if the lemon is a fruit. 2.2. Check if the orange is a fruit. 2.3. Check if the onion is a fruit. 3. Count the total number of identified fruits. 4. Compare the total number of fruits with the total number of objects mentioned. 5. Identify if there are objects that are not fruits. 6. Subtract the number of non-fruit objects from the total number of mentioned objects. 7. Confirm if the counted number of fruits matches the expected total of fruits. 8. If the fruit count matches the expected identification, conclude that the remaining objects are not fruits. 9. Calculate the total quantity of fruits. 10. Formulate the final response in English (en-US). You have 3 objects in total: a lemon, an orange, and an onion. The lemon and the orange are fruits, but the onion is not considered a fruit. Therefore, you have 2 fruits. PROMPT: Load: 00:00:31.1976 | TTFT: 00:00:30.7560 | TPS: 6.7478 | MPS: 56.1% | R: Yes | W: Yes | Net: Yes --reflection Enables the reflection capability of the loaded model on the terminal screen. If enabled, the model will reflect on the generated response immediately after answering and improve it if necessary.
sapilm --load model_name_1 --reflection PROMPT: If Maria is João's sister and José's mother, what is José to João? SAPIENS: José is João's nephew. The provided response is clear and direct, but it does not include an analysis of the family relationship. Although the relation from José to João is clearly identified as a nephew, it was not specified that João is José's uncle, which could be helpful for the context of the question. The response also does not include a brief summary of the family relation, which could provide a more complete understanding of the topic. Reformulando a resposta de acordo com a reflexão: José is João's nephew. In this scenario, João is José's uncle, and Maria is João's sister and José's mother, establishing a biological relationship among the three. PROMPT: Load: 00:00:21.2783 | TTFT: 00:00:20.8457 | TPS: 6.9994 | MPS: 55.9% | R: Yes | W: Yes | Net: Yes sapilm --load 1 --reflection PROMPT: What is the difference between even and odd numbers? SAPIENS: Even numbers are those that can be divided by 2 without leaving a remainder; that is, they are divisible by 2. Examples of even numbers include 2, 4, 6, 8, 10, etc. Odd numbers, on the other hand, cannot be divided by 2 without leaving a remainder. Examples of odd numbers include 1, 3, 5, 7, 9, etc. Therefore, the main difference is that even numbers are always divisible by 2, while odd numbers are not. The response provides a basic and clear explanation of even and odd numbers, but it is somewhat simplistic and does not address potential applications or consequences of these distinctions in more complex situations. Reformulating the response: Even numbers are numbers that can be divided by 2 without leaving a remainder; that is, they are divisible by 2. Examples of even numbers include 2, 4, 6, 8, 10, etc. Odd numbers, however, cannot be divided by 2 without leaving a remainder. Examples of odd numbers include 1, 3, 5, 7, 9, etc. Therefore, the main difference is that even numbers are always divisible by 2, while odd numbers are not. This distinction is important in various contexts, such as mathematics, programming, and science. In mathematics, for example, this distinction can affect the results of certain calculations. In programming, it can be used to control the execution of specific code paths. In science, it can be used to classify and categorize data. PROMPT: Load: 00:00:20.9653 | TTFT: 00:00:20.5170 | TPS: 6.9184 | MPS: 52.6% | R: Yes | W: Yes | Net: Yes It is also possible to use reasoning together with reflection.
{"data": [{"input": "string with a prompt sample...", "output": "string with a response sample..."}, ...]} or
[{"input": "string with a prompt sample...", "output": "string with a response sample..."}, ...] Add a string key named url_path with the path to a local or web file for training multimodal models.
sapilm --train /Users/User/Documents/datasets/data.md loading data: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 398M/398M [01:15<00:00, 5.30MB/s] [-------------------------------------------------------------------------- Training -------------------------------------------------------------------------] Reading data [========================================================================================================================================] 100.00% Coding: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3.35k/3.35k [00:00<00:00, 930kB/s] Coding: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 398M/398M [00:08<00:00, 48.8MB/s] If no name is defined, the model will be saved with the default name "default". All user-created foundation models will be saved with the ".model" extension.
sapilm --list +----+---------------------+----------+----------+ | ID | MODEL | EXT | SIZE | +----+---------------------+----------+----------+ | 1 | default | .model | 10.00 GB | | 2 | model_name_1 | .sapiens | 15.18 GB | | 3 | model_name_2 | .sapiens | 14.31 GB | | 4 | model_name_N | .sapiens | 28.97 GB | +----+---------------------+----------+----------+ It is also possible to continue training a model that was previously trained:
sapilm --load default --train /Users/User/Documents/datasets/data.txt --name continuous_model Decoding: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 385M/385M [00:00<00:00, 421MB/s] Decoding: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.64k/1.64k [00:00<00:00, 4.79MB/s] [------------------------------------------------------------------ Continuous pre-training ------------------------------------------------------------------] Reading data [========================================================================================================================================] 100.00% Coding: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3.38k/3.38k [00:00<00:00, 2.26MB/s] Coding: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 398M/398M [00:08<00:00, 48.1MB/s] sapilm --list +----+---------------------+----------+----------+ | ID | MODEL | EXT | SIZE | +----+---------------------+----------+----------+ | 1 | continuous_model | .model | 10.00 GB | | 2 | default | .model | 10.00 GB | | 3 | model_name_1 | .sapiens | 15.18 GB | | 4 | model_name_2 | .sapiens | 14.31 GB | | 5 | model_name_N | .sapiens | 28.97 GB | +----+---------------------+----------+----------+ --presets Enables downloading initial weights for training a model. This allows the model to start its training with initial basic learning, containing multilingual text comprehension capabilities.
First, we will generate a base model to fine-tune later:
sapilm --load base_model_N --fit /Users/User/Documents/datasets/data.json --name fit_model_N Decoding: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 385M/385M [00:00<00:00, 413MB/s] Decoding: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.48k/1.48k [00:00<00:00, 4.28MB/s] [------------------------------------------------------------------------ Fine-tuning ------------------------------------------------------------------------] Adjusting: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6/6 [00:00<00:00, 5379.61item/s] Coding: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3.44k/3.44k [00:00<00:00, 1.10MB/s] Coding: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 398M/398M [00:08<00:00, 48.7MB/s] --version Displays the current version of SapiLM installed on your local machine. The same as --v.
sapilm --version SapiLM 1.2.3 --v Displays the current version of SapiLM installed on your local machine. The same as --version.
sapilm --v SapiLM 1.2.3 Contributing We do not accept contributions that may result in changing the original code.
Make sure you are using the appropriate version.
This is proprietary software and its alteration and/or distribution without the developer's authorization is not permitted.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.




