Commit bff237e6 authored by Zhiwei Zhuang's avatar Zhiwei Zhuang
Browse files

change huggingface_login from str to bool for privacy

parent 0c5de3ac
...@@ -111,9 +111,9 @@ def parse_eval_args() -> argparse.Namespace: ...@@ -111,9 +111,9 @@ def parse_eval_args() -> argparse.Namespace:
help="Log error when tasks are not registered.", help="Log error when tasks are not registered.",
) )
parser.add_argument( parser.add_argument(
"--huggingface_token", "--huggingface_login",
type=str, action="store_true",
default=None, default=False,
help="huggingface token for downloading some authorization datasets, like toxigen, https://huggingface.co/settings/tokens", help="huggingface token for downloading some authorization datasets, like toxigen, https://huggingface.co/settings/tokens",
) )
return parser.parse_args() return parser.parse_args()
...@@ -132,10 +132,14 @@ def cli_evaluate(args: Union[argparse.Namespace, None] = None) -> None: ...@@ -132,10 +132,14 @@ def cli_evaluate(args: Union[argparse.Namespace, None] = None) -> None:
" --limit SHOULD ONLY BE USED FOR TESTING." " --limit SHOULD ONLY BE USED FOR TESTING."
"REAL METRICS SHOULD NOT BE COMPUTED USING LIMIT." "REAL METRICS SHOULD NOT BE COMPUTED USING LIMIT."
) )
if args.huggingface_token: if args.huggingface_login:
from huggingface_hub import login from huggingface_hub import login
login(token=args.huggingface_token) assert (
"HUGGINGFACE_LOGIN_TOKEN" in os.environ
), "Your environment variable does not contain a HUGGINGFACE_LOGIN_TOKEN. Please set the token first."
huggingface_token = os.environ["HUGGINGFACE_LOGIN_TOKEN"]
login(token=huggingface_token)
if args.include_path is not None: if args.include_path is not None:
eval_logger.info(f"Including path: {args.include_path}") eval_logger.info(f"Including path: {args.include_path}")
include_path(args.include_path) include_path(args.include_path)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment