@@ -102,6 +102,30 @@ Next, you must run the installation/initialize command to download the shared li
102102./vendor/bin/transformers install
103103```
104104
105+ > [ !CAUTION]
106+ > These shared libraries to be downloaded are platform-specific, so it's important to run this command on the target
107+ > platform where the code will be executed. For example, if you're using a Docker container, run the ` install ` command
108+ > inside that container.
109+
110+ ## PHP FFI Extension
111+
112+ Transformers PHP uses the PHP FFI extension to interact with the ONNX runtime. The FFI extension is included by default
113+ in PHP 7.4 and later, but it may not be enabled by default. If the FFI extension is not enabled, you can enable it by
114+ uncommenting(remove the ` ; ` from the beginning of the line) the
115+ following line in your ` php.ini ` file:
116+
117+ ``` ini
118+ extension = ffi
119+ ```
120+
121+ Also, you need to set the ` ffi.enable ` directive to ` true ` in your ` php.ini ` file:
122+
123+ ``` ini
124+ ffi.enable = true
125+ ```
126+
127+ After making these changes, restart your web server or PHP-FPM service, and you should be good to go.
128+
105129## Documentation
106130
107131For more detailed information on how to use the library, check out the
@@ -120,12 +144,13 @@ You can configure the behaviour of the Transformers PHP library as follows:
120144``` php
121145use Codewithkyrian\Transformers\Transformers;
122146
123- Transformers::configure ()
147+ Transformers::setup ()
124148 ->setCacheDir('...') // Set the default cache directory for transformers models. Defaults to `.transformers-cache/models`
125149 ->setRemoteHost('...') // Set the remote host for downloading models. Defaults to `https://huggingface.co`
126150 ->setRemotePathTemplate('...') // Set the remote path template for downloading models. Defaults to `{model}/resolve/{revision}/{file}`
127151 ->setAuthToken('...') // Set the auth token for downloading models. Defaults to `null`
128- ->setUserAgent('...'); // Set the user agent for downloading models. Defaults to `transformers-php/{version}`
152+ ->setUserAgent('...') // Set the user agent for downloading models. Defaults to `transformers-php/{version}`
153+ ->apply(); // Apply the configuration
129154```
130155
131156You can call the ` set ` methods in any order, or leave any out entirely, in which case, it uses the default values. For
0 commit comments