| 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | # All rights reserved. |
| 3 | # |
| 4 | # This source code is licensed under the terms described in the LICENSE file in |
| 5 | # the root directory of this source tree. |
| 6 | |
| 7 | # supress warnings and spew of logs from hugging face |
| 8 | import transformers |
| 9 | |
| 10 | from .base import ( # noqa: F401 |
| 11 | DummyShield, |
| 12 | OnViolationAction, |
| 13 | ShieldBase, |
| 14 | ShieldResponse, |
| 15 | TextShield, |
| 16 | ) |
| 17 | from .code_scanner import CodeScannerShield # noqa: F401 |
| 18 | from .contrib.third_party_shield import ThirdPartyShield # noqa: F401 |
| 19 | from .llama_guard import LlamaGuardShield # noqa: F401 |
| 20 | from .prompt_guard import ( # noqa: F401 |
| 21 | InjectionShield, |
| 22 | JailbreakShield, |
| 23 | PromptGuardShield, |
| 24 | ) |
| 25 | |
| 26 | transformers.logging.set_verbosity_error() |
| 27 | |
| 28 | import os |
| 29 | |
| 30 | os.environ["TOKENIZERS_PARALLELISM"] = "false" |
| 31 | |
| 32 | import warnings |
| 33 | |
| 34 | warnings.filterwarnings("ignore") |