Saeed commited on
Commit
b144b5b
·
verified ·
1 Parent(s): 9379127

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +152 -0
README.md ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TissueGPT: Fine-Tuned BioGPT for Biomedical Text Generation
2
+
3
+ ## Model Description
4
+ **TissueGPT** is a fine-tuned version of [BioGPT](https://huggingface.co/microsoft/BioGPT), specifically tailored for biomedical text generation tasks. By leveraging a dataset of biomedical research articles (titles, abstracts, and full texts), TissueGPT is designed to perform tasks such as:
5
+
6
+ - Summarizing biomedical literature
7
+ - Generating coherent biomedical text
8
+ - Assisting with scientific writing in life sciences
9
+ - Supporting research in tissue engineering, extracellular matrix (ECM) analysis, and related fields
10
+
11
+ ---
12
+
13
+ ## Training Details
14
+
15
+ ### First Round of Training
16
+ The initial model was fine-tuned for **3 epochs**, focusing on general adaptation to the biomedical dataset.
17
+
18
+ #### Hyperparameters
19
+ - **Learning Rate**: 5e-5
20
+ - **Batch Size**: 8
21
+ - **Warmup Steps**: 500
22
+ - **Precision**: Mixed precision (`fp16`)
23
+ - **Weight Decay**: 0.01
24
+ - **Number of Epochs**: 3
25
+ - **Save Checkpoints**: Every 10,000 steps, keeping the last 3 checkpoints
26
+
27
+ #### Training and Validation Metrics
28
+ | Epoch | Training Loss | Validation Loss | Perplexity |
29
+ |-------|---------------|-----------------|------------|
30
+ | 1 | 2.4752 | 2.4286 | 11.34 |
31
+ | 2 | 2.3680 | 2.3708 | 10.70 |
32
+ | 3 | 2.2954 | 2.3410 | 10.39 |
33
+
34
+ ---
35
+
36
+ ### Second Round of Training
37
+ To further improve performance, the model was fine-tuned for **2 additional epochs** with adjusted hyperparameters.
38
+
39
+ #### Adjusted Hyperparameters
40
+ - **Learning Rate**: 3e-5 (reduced for finer updates)
41
+ - **Batch Size**: 64 (to utilize the GPU’s full memory)
42
+ - **Precision**: `bf16` (optimized for NVIDIA A100)
43
+ - **Save Checkpoints**: Every 20,000 steps
44
+
45
+ #### Training and Validation Metrics
46
+ | Epoch | Training Loss | Validation Loss | Perplexity |
47
+ |-------|---------------|-----------------|------------|
48
+ | 4 | 2.2396 | 2.2395 | 9.43 |
49
+ | 5 | 2.2328 | 2.2328 | 9.32 |
50
+
51
+ ### Hardware Used
52
+ - **GPU**: NVIDIA A100 80GB
53
+ - **Framework**: PyTorch with Hugging Face Transformers library
54
+
55
+ ---
56
+
57
+ ## Evaluation Metrics
58
+
59
+ ### Perplexity
60
+ Perplexity is a key metric for evaluating language models, measuring how well the model predicts sequences of text. Lower perplexity indicates better predictive performance.
61
+
62
+ - **First Round of Training**: Final perplexity = **10.39**
63
+ - **Second Round of Training**: Final perplexity = **9.32**
64
+
65
+ A lower perplexity indicates that the model generates more fluent and coherent text.
66
+
67
+ ### Gradient Norms
68
+ - Tracked gradient stability during training.
69
+ - Observed Range: **1.05–1.32**, indicating stable training.
70
+
71
+ ### Validation Loss
72
+ - Decreasing validation loss across both rounds suggests effective generalization to unseen data.
73
+
74
+ ---
75
+
76
+ ## Model Comparison
77
+
78
+ | Metric | First Round | Second Round |
79
+ |--------------------|-------------|--------------|
80
+ | Final Validation Loss | 2.3410 | 2.2328 |
81
+ | Final Perplexity | 10.39 | 9.32 |
82
+
83
+ **Key Insights**:
84
+ - Additional training epochs led to improved generalization and better predictive performance.
85
+ - Perplexity improved by approximately 10% in the second round, demonstrating enhanced text fluency and coherence.
86
+
87
+ ---
88
+
89
+ ## How to Use the Model
90
+
91
+ ### Install Dependencies
92
+ Ensure you have `transformers` and `torch` installed:
93
+
94
+ ```bash
95
+ pip install transformers torch
96
+ ```
97
+ ### Load the Model
98
+
99
+ ``` python
100
+ from transformers import AutoTokenizer, AutoModelForCausalLM
101
+
102
+ model_name = "Saeed/TissueGPT" # Replace with the uploaded repo name
103
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
104
+ model = AutoModelForCausalLM.from_pretrained(model_name)
105
+
106
+ input_text = "The extracellular matrix plays a critical role in tissue engineering because"
107
+ inputs = tokenizer(input_text, return_tensors="pt")
108
+
109
+ output = model.generate(**inputs, max_length=50)
110
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
111
+ ```
112
+
113
+ ----------
114
+
115
+ ## Intended Use
116
+
117
+ - **Biomedical text generation and summarization**
118
+ - **Assisting researchers, scientists, and medical professionals**
119
+ - **Automated scientific writing** in domains like tissue engineering, and scaffold fabrication.
120
+
121
+ ----------
122
+
123
+ ## Limitations
124
+
125
+ - The model is fine-tuned on biomedical literature and may not generalize well to non-biomedical domains.
126
+ - Outputs should always be validated by experts for accuracy, especially in clinical or research-critical contexts.
127
+
128
+ ----------
129
+
130
+ ## Ethical Considerations
131
+
132
+ - This model is intended for use in biomedical research and not for clinical diagnosis or patient care.
133
+ - It may generate plausible-sounding but factually incorrect outputs (hallucinations). Always verify generated content.
134
+
135
+ ----------
136
+
137
+ ## Citation
138
+
139
+ If you use **TissueGPT**, please cite the following:
140
+
141
+ ***The citation details will be provided shortly.***
142
+ ## License
143
+
144
+ Licensed under the **CC BY 4.0** License.
145
+ ## Contact
146
+
147
+ For questions, issues, or collaboration opportunities, feel free to reach out at:
148
+
149
+ - **Name**: Saeed Rafieyan
150
+ - **Website**: Sraf.ir
151
+ - **Email**: Raf.Biomed@gmail.com
152
+ - **LinkedIn**: https://www.linkedin.com/in/saeed-rafieyan