dodanie przykładu uzycia na koniec
This commit is contained in:
parent
414805d574
commit
1a41ca184b
5
hft.py
5
hft.py
|
|
@ -205,3 +205,8 @@ def generate_answer(question, model, tokenizer, source_mapper, max_length=200):
|
||||||
# Pobierz źródło z ostatniego tokena
|
# Pobierz źródło z ostatniego tokena
|
||||||
last_token_id = outputs.sequences[0][-1].item()
|
last_token_id = outputs.sequences[0][-1].item()
|
||||||
source_idx = model.source_embeddi
|
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)
|
||||||
Loading…
Reference in New Issue