neil-code/dialogsum-test
Viewer • Updated • 3k • 670 • 15
How to use NikkeS/Phi-2-dialogsum-finetuned with Transformers:
# Use a pipeline as a high-level helper
# Warning: Pipeline type "summarization" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# 'pip install "transformers<5.0.0'
from transformers import pipeline
pipe = pipeline("summarization", model="NikkeS/Phi-2-dialogsum-finetuned") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("NikkeS/Phi-2-dialogsum-finetuned", dtype="auto")This is a fine-tuned version of Phi-2, optimized for dialogue summarization. The model is trained on a dataset containing human conversations and their respective summaries, allowing it to generate concise and coherent summaries of dialogue-based texts.
microsoft/phi-2from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "your-username/phi-2-dialogue-summarization"
tokenizer = AutoTokenizer.from_pretrained(NikkeS/Phi-2-dialogsum-finetuned)
model = AutoModelForCausalLM.from_pretrained(NikkeS/Phi-2-dialogsum-finetuned)
prompt = "Summarize the following conversation:\n\n#Person1#: Hello! How are you?\n#Person2#: I'm good, thanks. How about you?\n\nSummary:"
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
output = model.generate(input_ids, max_length=100)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Base model
microsoft/phi-2