Spaces:
Running
Running
Download patch_supar.py from mm58/Sebayhi_new: direct link, hf CLI and curl.
- Browser
- Download file 573 Bytes
-
https://huggingface.co/spaces/mm58/Sebayhi_new/resolve/main/patch_supar.py
- Command line
-
hf download hf://spaces/mm58/Sebayhi_new/patch_supar.py
-
curl -L -o patch_supar.py https://huggingface.co/spaces/mm58/Sebayhi_new/resolve/main/patch_supar.py
573 Bytes
| filepath = '/usr/local/lib/python3.11/site-packages/supar/utils/fn.py' | |
| patch = ( | |
| "import multiprocess as mp\n" | |
| "from transformers import BertTokenizerFast\n" | |
| "if not hasattr(BertTokenizerFast, 'split_special_tokens'):\n" | |
| " BertTokenizerFast.split_special_tokens = False\n\n" | |
| ) | |
| with open(filepath, 'r') as f: | |
| content = f.read() | |
| if 'split_special_tokens' not in content: | |
| with open(filepath, 'w') as f: | |
| f.write(patch + content) | |
| # Confirm patch is at top | |
| first_line = open(filepath).readline() | |
| print(f"First line of fn.py: {first_line}") | |