in src/alpaca_eval/utils.py [0:0]
def read_or_return(to_read: Union[AnyPath, str], **kwargs):
"""Read a file or return the input if it is already a string."""
try:
with open(Path(to_read), **kwargs) as f:
out = f.read()
except FileNotFoundError as e:
if Path(to_read).is_absolute():
# The path is not absolute, so it's not just a string
raise e
logging.warning(f"Returning input because file not found. Error: {e}")
out = to_read
return out