PHPackages                             sajjadh47/bpe-encoder-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sajjadh47/bpe-encoder-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sajjadh47/bpe-encoder-php
=========================

BPE (Byte-Pair Encoding) Encoder Decoder for OpenAI's GPT-2 / GPT-3 Implemented In Pure PHP, Zero Dependency, Multi Byte Supported.

v1.0.0(3y ago)430MITPHPPHP &gt;=7.4

Since Feb 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sajjadh47/bpe-encoder-php)[ Packagist](https://packagist.org/packages/sajjadh47/bpe-encoder-php)[ RSS](/packages/sajjadh47-bpe-encoder-php/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

About
-----

[](#about)

BPE Encoder Decoder for GPT-2 / GPT-3 Implemented In PHP. This is a PHP implementation of OpenAI's original python encoder/decoder which can be found [here](https://github.com/openai/gpt-2/blob/master/src/encoder.py). It follows 99% exact OpenAI's Python's implementation algorithms to acquire the speed and multi byte encodings.

Install with composer
---------------------

[](#install-with-composer)

```
composer require sajjadh47/bpe-encoder-php

```

Usage
-----

[](#usage)

Minimum PHP Version For This Package Is &gt;= 7.4 With `mb_*` [functions](https://www.php.net/manual/en/book.mbstring.php) enabled for multi byte encodings.

```
