From 1a41ca184b435c01d2768492bbac8b1b13c9e70a Mon Sep 17 00:00:00 2001 From: "l.gabrysiak" Date: Tue, 25 Feb 2025 17:35:29 +0100 Subject: [PATCH] =?UTF-8?q?dodanie=20przyk=C5=82adu=20uzycia=20na=20koniec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hft.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hft.py b/hft.py index 86a3048..8196610 100644 --- a/hft.py +++ b/hft.py @@ -205,3 +205,8 @@ def generate_answer(question, model, tokenizer, source_mapper, max_length=200): # Pobierz źródło z ostatniego tokena last_token_id = outputs.sequences[0][-1].item() source_idx = model.source_embeddi + +# Przykład użycia +question = "Ile dni urlopu przysługuje pracownikowi?" +answer = generate_answer(question, model, tokenizer, source_mapper) +print(answer) \ No newline at end of file