Open XuandongZhao opened 2 years ago
I solved it by modifying the code in openprompt:
def incorporate_text_example(self,
example: InputExample,
text = None,
):
if text is None:
text = self.text.copy()
else:
text = text.copy()
for i, d in enumerate(text):
if 'placeholder' in d:
##################
tempa = d.get("post_processing", lambda x:x)
if tempa == "lambda x:x.strip('.')":
tempa = lambda x:x.strip('.')
tempb = tempa(getattr(example, d['placeholder']))
text[i] = d["add_prefix_space"] + tempb
##################
elif 'meta' in d:
text[i] = d["add_prefix_space"] + d.get("post_processing", lambda x:x)(example.meta[d['meta']])
elif 'soft' in d:
text[i] = ''; # unused
elif 'mask' in d:
text[i] = '<mask>'
elif 'special' in d:
text[i] = d['special']
elif 'text' in d:
text[i] = d["add_prefix_space"] + d['text']
else:
raise ValueError(f'can not parse {d}')
return text
can you pr ?
What do you mean by "pr"?
how do you put this repo with openprompt? my code goes wrong with "OSError: ../plm_cache/roberta-large is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'
If this is a private repository, make sure to pass a token having permission to this repo with use_auth_token
or log in with huggingface-cli login
and pass use_auth_token=True
."
I guess it might be the location problem , i put this repo with openprompt in the same folder
how do you put this repo with openprompt? my code goes wrong with "OSError: ../plm_cache/roberta-large is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models' If this is a private repository, make sure to pass a token having permission to this repo with
use_auth_token
or log in withhuggingface-cli login
and passuse_auth_token=True
." I guess it might be the location problem , i put this repo with openprompt in the same folder
Maybe you need to change the path of MODEL_NAME_OR_PATH
I have already installed the latest openprompt package. And the script for KPT is
And I got the error:
Could you please check about it?