@@ -11,8 +11,9 @@ Before installing TransformersPHP, ensure your system meets the following requir
1111- PHP 8.1 or above
1212- Composer
1313- PHP FFI extension
14- - JIT compilation (optional)
14+ - JIT compilation (optional, for performance )
1515- Increased memory limit (for advanced tasks like text generation)
16+ - OpenMP (optional, for multithreaded execution)
1617
1718## Installation
1819
@@ -30,12 +31,12 @@ can install them manually using the following command:
3031```
3132
3233> [ !CAUTION]
33- > The ONNX library is platform-specific, so it's important to run the ` composer require ` , or ` transformers install `
34+ > The shared libraries is platform-specific, so it's important to run the ` composer require ` , or ` transformers install `
3435> command on the target platform where the code will be executed. In most cases, this will be your development machine
3536> or a server where you deploy your application, but if you're using a Docker container, run the ` composer require `
3637> command inside that container.
3738
38- This command sets up everything you need to start using pre-trained ONNX models with TransformersPHP .
39+ That's it! You're now ready to use TransformersPHP in your PHP application .
3940
4041## Pre-Download Models
4142
@@ -180,3 +181,38 @@ opcache.jit = tracing
180181Here's a deeper guide by [ Brent] ( https://twitter.com/brendt_gd ) on how to configure JIT
181182compilation: [ https://stitcher.io/blog/php-8-jit-setup ] ( https://stitcher.io/blog/php-8-jit-setup )
182183
184+ ## Memory Limit
185+
186+ While TransformersPHP is designed to be memory-efficient, not all models are created equal. Some models require more
187+ memory than others, especially when performing advanced tasks like text generation. To avoid memory-related issues, we
188+ recommend increasing the memory limit in your ` php.ini ` file:
189+
190+ ``` ini
191+ memory_limit = 512M
192+ ```
193+
194+ You can adjust the memory limit based on your system's capabilities and the models you plan to use.
195+
196+ ## OpenMP (Optional)
197+
198+ OpenMP is a set of compiler directives and library routines that enable parallel processing in C, C++, and Fortran
199+ programs. TransformersPHP uses OpenMP to enable multithreaded operations in the Tensors, which can improve performance
200+ on multi-core systems. OpenMP is not required, but it can provide a significant performance boost for some operations.
201+ Checkout the [ OpenMP website] ( https://www.openmp.org/ ) for more information on how to install and configure OpenMP on
202+ your system.
203+
204+ Example: On Ubuntu, you can install OpenMP using the following command:
205+
206+ ``` bash
207+ sudo apt-get install libomp-dev
208+ ```
209+
210+ And for MacOS, you can install OpenMP using Homebrew:
211+
212+ ``` bash
213+ brew install libomp
214+ ```
215+
216+ If OpenMP is not available on your system, TransformersPHP will fall back to single-threaded execution.
217+
218+
0 commit comments