Spaces:
Running
Running
| 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}") | |