feat: Allow toggling verbosity
This commit is contained in:
parent
668c7ee6c5
commit
fa0b0b10cc
1 changed files with 12 additions and 7 deletions
|
@ -24,11 +24,12 @@ logging.basicConfig(level=logging.INFO)
|
|||
logger = logging.getLogger("gguf-chat-template")
|
||||
|
||||
|
||||
def get_chat_template(model_file: str) -> str:
|
||||
def get_chat_template(model_file: str, verbose: bool = False) -> str:
|
||||
reader = GGUFReader(model_file)
|
||||
|
||||
# Available keys
|
||||
logger.info("Detected model metadata!")
|
||||
if verbose:
|
||||
logger.info("Outputting available model fields:")
|
||||
for key in reader.fields.keys():
|
||||
logger.info(key)
|
||||
|
@ -103,12 +104,16 @@ def main():
|
|||
action="store_true",
|
||||
help="Render the chat template using Jinja2",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-v",
|
||||
"--verbose",
|
||||
action="store_true",
|
||||
help="Output model keys",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
model_file = args.model_file
|
||||
chat_template = get_chat_template(model_file)
|
||||
|
||||
chat_template = get_chat_template(model_file, args.verbose)
|
||||
display_chat_template(chat_template, render_template=args.render_template)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue