thunlp / OpenPrompt

An Open-Source Framework for Prompt-Learning.
https://thunlp.github.io/OpenPrompt/
Apache License 2.0
4.38k stars 455 forks source link

Fix bug when trying KPT #211

Closed Luobots closed 2 years ago

Luobots commented 2 years ago

The value in d["post_processing"] isn't always belong to callable function but str, I fix it by using eval() in a lightweight way.

Luobots commented 2 years ago

Sometimes the value in d["post_processing"] is a lambda-style str like "lambda x:x.strip('.')", so the eval() works.