Spaces:
Sleeping
Sleeping
File size: 573 Bytes
eece98d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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}")
|