Get default BPE file path.
()
| 57 | |
| 58 | |
| 59 | def default_bpe(): |
| 60 | """Get default BPE file path.""" |
| 61 | bpe_path = _find_bpe_file() |
| 62 | if bpe_path is None: |
| 63 | # Try to use open_clip's default if available |
| 64 | try: |
| 65 | from open_clip.tokenizer import default_bpe as _default_bpe |
| 66 | return _default_bpe() |
| 67 | except ImportError: |
| 68 | raise FileNotFoundError( |
| 69 | "BPE vocabulary file not found. Please ensure bpe_simple_vocab_16e6.txt.gz " |
| 70 | "is available in one of the expected locations, or install open_clip." |
| 71 | ) |
| 72 | return bpe_path |
| 73 | |
| 74 | |
| 75 | @lru_cache() |
no test coverage detected