Skip to content

Commit

Permalink
Add quiet mode to download
Browse files Browse the repository at this point in the history
  • Loading branch information
ZJaume committed Jul 11, 2023
1 parent 2f0e092 commit 3fc1f01
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/bicleaner_ai/bicleaner_ai_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from huggingface_hub import snapshot_download
from huggingface_hub.utils import RepositoryNotFoundError, HFValidationError
from huggingface_hub import logging as hf_logging
from huggingface_hub.utils import disable_progress_bars
from requests import get


Expand All @@ -16,7 +18,11 @@
def logging_setup(args):
logger = logging.getLogger()
logger.handlers = []
if args.debug:
if args.quiet:
logger.setLevel(logging.ERROR)
hf_logging.set_verbosity_error()
disable_progress_bars()
elif args.debug:
logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.INFO)
Expand All @@ -38,6 +44,7 @@ def main():
help='Path to download the model (only for old Github models)')
parser.add_argument('-t', '--auth_token', default=None, type=str,
help='Authentication token for private models downloading')
parser.add_argument('-q', '--quiet', action='store_true', help='Suppress logging messages')
parser.add_argument('--debug', action='store_true')

args = parser.parse_args()
Expand Down

0 comments on commit 3fc1f01

Please sign in to comment.