From 1e29045edb4e63192f598a536c3eaffcdb58ccea Mon Sep 17 00:00:00 2001 From: Gabriele Sarti Date: Tue, 27 Feb 2024 21:48:03 +0100 Subject: [PATCH] Fix attribute-context for current preceding context in input --- inseq/commands/attribute_context/attribute_context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inseq/commands/attribute_context/attribute_context.py b/inseq/commands/attribute_context/attribute_context.py index 7edd72e2..64687851 100644 --- a/inseq/commands/attribute_context/attribute_context.py +++ b/inseq/commands/attribute_context/attribute_context.py @@ -68,11 +68,11 @@ def attribute_context_with_model(args: AttributeContextArgs, model: HuggingfaceM args.generation_kwargs["forced_bos_token_id"] = model.tokenizer.lang_code_to_id[tgt_lang] # Prepare input/outputs (generate if necessary) - input_full_text = format_template(args.input_template, args.input_current_text, args.input_context_text) if "{current}" in args.contextless_input_current_text: args.input_current_text = args.contextless_input_current_text.format(current=args.input_current_text) else: args.input_current_text = args.contextless_input_current_text + input_full_text = format_template(args.input_template, args.input_current_text, args.input_context_text) args.output_context_text, args.output_current_text = prepare_outputs( model=model, input_context_text=args.input_context_text,