3.9 KiB
language, library_name, pipeline_tag, tags
| language | library_name | pipeline_tag | tags | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
transformers | text-generation |
|
GPT2-disease_text_generation
This model is a fine-tuned GPT-2 model for Vietnamese disease-related text continuation.
It is intended to continue a partially written passage about common health conditions such as heart disease, stomach pain, diabetes, high blood pressure, and similar medical topics.
Intended Use
This model is suitable for:
- continuing short disease descriptions in Vietnamese
- generating sample text for text-generation experiments
- demonstrating topic-conditioned Vietnamese causal language modeling
This model is not designed as a question-answering system and must not be used as medical advice.
Recommended Prompt Style
The model works best when the input is an unfinished sentence or an opening paragraph that should be continued.
Example:
Bệnh tim là một trong những nhóm bệnh phổ biến, ảnh hưởng đến khả năng bơm máu của cơ thể và làm suy giảm sức khỏe. Người mắc bệnh tim thường có biểu hiện đau ngực, khó thở, tim đập nhanh, mệt mỏi và chóng mặt khi vận động. Nguyên nhân có thể liên quan đến tăng huyết áp, mỡ máu cao, tiểu đường, hút thuốc lá hoặc căng thẳng kéo dài. Nếu không được phát hiện và điều trị sớm, bệnh tim có thể dẫn đến nhiều biến chứng nguy hiểm như suy tim, nhồi máu cơ tim hoặc
Another example:
Đau dạ dày là tình trạng thường gặp ở nhiều người, có thể gây đau vùng thượng vị, đầy hơi, buồn nôn và khó tiêu. Bệnh có thể xuất hiện do ăn uống thất thường, căng thẳng kéo dài hoặc vi khuẩn Helicobacter pylori. Nếu chủ quan, người bệnh có thể gặp biến chứng như viêm loét nghiêm trọng hoặc
Prompt Style To Avoid
Question-answer prompts are less reliable for this model.
Example:
Câu hỏi: Triệu chứng của bệnh tim là gì?
Trả lời:
Because this is a continuation model, outputs may become repetitive, drift in structure, or confuse disease entities when used like a QA model.
Usage With Transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "sanim05/GPT2-disease_text_generation"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
prompt = (
"Bệnh tim là một trong những nhóm bệnh phổ biến, ảnh hưởng đến khả năng bơm máu "
"của cơ thể và làm suy giảm sức khỏe. Người mắc bệnh tim thường có biểu hiện đau ngực, "
"khó thở, tim đập nhanh, mệt mỏi và chóng mặt khi vận động. Nguyên nhân có thể liên quan "
"đến tăng huyết áp, mỡ máu cao, tiểu đường, hút thuốc lá hoặc căng thẳng kéo dài. "
"Nếu không được phát hiện và điều trị sớm, bệnh tim có thể dẫn đến nhiều biến chứng nguy hiểm như"
)
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(
**inputs,
max_new_tokens=80,
do_sample=True,
temperature=0.8,
top_p=0.95,
repetition_penalty=1.1,
pad_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Limitations
- The model can repeat words or short phrases.
- The model can mix symptoms or descriptions across different diseases.
- The model does not guarantee medical accuracy.
- The model is not suitable for diagnosis, treatment, or clinical recommendations.
Safety Notice
Generated text should be used only for research, learning, or technical experimentation.
Do not rely on this model for professional medical guidance.