Ignore warnings on Colab

This commit is contained in:
oobabooga 2023-10-21 21:45:25 -07:00
parent 1a34927314
commit 2d1b3332e4

View File

@ -1,4 +1,5 @@
import argparse import argparse
import os
import sys import sys
from collections import OrderedDict from collections import OrderedDict
from pathlib import Path from pathlib import Path
@ -189,12 +190,13 @@ for k in ['chat', 'notebook', 'no_stream']:
# Security warnings # Security warnings
if args.trust_remote_code: if args.trust_remote_code:
logger.warning('trust_remote_code is enabled. This is dangerous.') logger.warning('trust_remote_code is enabled. This is dangerous.')
if args.share: if not 'COLAB_GPU' in os.environ:
logger.warning("The gradio \"share link\" feature uses a proprietary executable to create a reverse tunnel. Use it with care.") if args.share:
if any((args.listen, args.share)) and not any((args.gradio_auth, args.gradio_auth_path)): logger.warning("The gradio \"share link\" feature uses a proprietary executable to create a reverse tunnel. Use it with care.")
logger.warning("\nYou are potentially exposing the web UI to the entire internet without any access password.\nYou can create one with the \"--gradio-auth\" flag like this:\n\n--gradio-auth username:password\n\nMake sure to replace username:password with your own.") if any((args.listen, args.share)) and not any((args.gradio_auth, args.gradio_auth_path)):
if args.multi_user: logger.warning("\nYou are potentially exposing the web UI to the entire internet without any access password.\nYou can create one with the \"--gradio-auth\" flag like this:\n\n--gradio-auth username:password\n\nMake sure to replace username:password with your own.")
logger.warning('\nThe multi-user mode is highly experimental and should not be shared publicly.') if args.multi_user:
logger.warning('\nThe multi-user mode is highly experimental and should not be shared publicly.')
def fix_loader_name(name): def fix_loader_name(name):