Better warning messages
This commit is contained in:
parent
0a48b29cd8
commit
95d04d6a8d
13 changed files with 194 additions and 83 deletions
|
@ -1,4 +1,5 @@
|
|||
import argparse
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
@ -170,19 +171,19 @@ args_defaults = parser.parse_args([])
|
|||
deprecated_dict = {}
|
||||
for k in deprecated_dict:
|
||||
if getattr(args, k) != deprecated_dict[k][1]:
|
||||
print(f"Warning: --{k} is deprecated and will be removed. Use --{deprecated_dict[k][0]} instead.\n")
|
||||
logging.warning(f"--{k} is deprecated and will be removed. Use --{deprecated_dict[k][0]} instead.")
|
||||
setattr(args, deprecated_dict[k][0], getattr(args, k))
|
||||
|
||||
# Deprecation warnings for parameters that have been removed
|
||||
if args.cai_chat:
|
||||
print("Warning: --cai-chat is deprecated. Use --chat instead.\n")
|
||||
logging.warning("--cai-chat is deprecated. Use --chat instead.")
|
||||
args.chat = True
|
||||
|
||||
# Security warnings
|
||||
if args.trust_remote_code:
|
||||
print("Warning: trust_remote_code is enabled. This is dangerous.\n")
|
||||
logging.warning("trust_remote_code is enabled. This is dangerous.")
|
||||
if args.share:
|
||||
print("Warning: the gradio \"share link\" feature downloads a proprietary and\nunaudited blob to create a reverse tunnel. This is potentially dangerous.\n")
|
||||
logging.warning("The gradio \"share link\" feature downloads a proprietary and unaudited blob to create a reverse tunnel. This is potentially dangerous.")
|
||||
|
||||
# Activating the API extension
|
||||
if args.api or args.public_api:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue