Safetensors
mkurman commited on
Commit
430efd9
·
verified ·
1 Parent(s): 4652bd6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +160 -3
README.md CHANGED
@@ -1,3 +1,160 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - HuggingFaceTB/smollm-corpus
5
+ - HuggingFaceFW/fineweb-edu
6
+ ---
7
+
8
+ # MedIT One – 140M Checkpoint (Fifth Checkpoint After 9B Tokens)
9
+
10
+ **Repository:** [MedITSolutionsKurman/medit-one](https://github.com/MedITSolutionsKurman/medit-one)
11
+
12
+ **Model Type:** Causal Language Model (OneForCausalLM)
13
+
14
+ **Checkpoint:** 140M parameters, fifth checkpoint after 9B tokens
15
+
16
+ **Tokenizer** [HuggingFaceTB/SmolLM2-1.7B-Instruct](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct)
17
+
18
+ ---
19
+
20
+ ## Model Overview
21
+
22
+ The MedIT One model is an early checkpoint in the development of the One series, evaluated after 9 billion tokens of training.
23
+ It is designed for natural language generation tasks and is implemented with a focus on high performance on causal language modeling.
24
+ This checkpoint contains 140 million parameters and is built using PyTorch with support for `bfloat16` precision, making it suitable for GPU-accelerated inference.
25
+
26
+ ---
27
+
28
+ ## Intended Use
29
+
30
+ - **Primary Applications:** Natural language generation, research experiments, and prompt completion tasks.
31
+ - **Research:** This model checkpoint is provided as an early checkpoint and can be used for studying model behaviors, especially regarding repetitive generation.
32
+ - **Prototyping:** Developers and researchers can use this checkpoint to explore early results and understand the evolution of the Medit series.
33
+
34
+ **Caution:** As an early checkpoint, the model tends to exhibit repetitive generation. Users should set the repetition penalty (recommended value: 1.2) during inference to mitigate this behavior.
35
+
36
+ ---
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ # From source (without CUDA acceleration)
42
+ git clone https://github.com/MedITSolutionsKurman/medit-one
43
+ cd medit-one
44
+ pip install -e .
45
+
46
+ # From source with CUDA acceleration
47
+ python install_cuda.py
48
+
49
+ # For training capabilities only
50
+ pip install -e ".[training]"
51
+
52
+ # For full installation with all features including CUDA acceleration
53
+ pip install -e ".[full]"
54
+ ```
55
+
56
+
57
+ ## How to Use
58
+
59
+ After installing the `medit-one` package from the repository, the model can be loaded and run with the following code snippet:
60
+
61
+ ```python
62
+ import sys
63
+ import os
64
+ import warnings
65
+
66
+ import torch
67
+ from tqdm import tqdm
68
+ import numpy as np
69
+ from transformers import AutoTokenizer, TextStreamer
70
+
71
+ from one.modeling_one import OneForCausalLM
72
+
73
+ # Set the model checkpoint path
74
+ path = 'meditsolutions/medit-one-140M-9B-tokens-checkpoint'
75
+
76
+ # Load the tokenizer and model
77
+ tokenizer = AutoTokenizer.from_pretrained(path)
78
+ model = OneForCausalLM.from_pretrained(path, torch_dtype=torch.bfloat16)
79
+
80
+ device = 'cuda'
81
+ model.to(device)
82
+
83
+ text = 'The role of artificial intelligence'
84
+
85
+ # Tokenize input text
86
+ tokens = tokenizer(text, return_tensors='pt')
87
+ tokens.to(device)
88
+
89
+ from time import time
90
+
91
+ start = time()
92
+
93
+ # Inference with recommended repetition penalty
94
+ with torch.autocast(device_type=device, dtype=torch.bfloat16):
95
+ with torch.no_grad():
96
+ model.eval()
97
+ output = model.generate(
98
+ **tokens,
99
+ max_new_tokens=1024,
100
+ streamer=TextStreamer(tokenizer),
101
+ do_sample=None,
102
+ temperature=None,
103
+ repetition_penalty=1.2,
104
+ use_cache=True,
105
+ output_attentions=False,
106
+ eos_token_id=model.config.eos_token_id if model.config.eos_token_id is not None else tokenizer.eos_token_id
107
+ )
108
+
109
+ end = time()
110
+ tokens_per_sec = len(output[0]) / (end - start)
111
+ print(f'Time taken: {end - start} seconds, tokens per s: {tokens_per_sec}')
112
+ ```
113
+
114
+ **Note:** When using this checkpoint, it is essential to apply a repetition penalty of 1.2 to help control the model’s tendency toward repetitive text generation.
115
+
116
+ ---
117
+
118
+ ## Model Details
119
+
120
+ - **Parameters:** 140M (early checkpoint)
121
+ - **Training Tokens:** Evaluated after 9B tokens
122
+ - **Precision:** Supports `bfloat16` for accelerated computation on compatible hardware
123
+ - **Architecture:** Causal language model implemented in PyTorch, part of the MedIT One series
124
+
125
+ ---
126
+
127
+ ## Limitations & Considerations
128
+
129
+ - **Repetition:** This early checkpoint is known to produce repetitive outputs. Adjusting the repetition penalty (recommended: 1.2) is necessary to reduce this effect.
130
+ - **Early Checkpoint Status:** As a checkpoint from an early stage of training, performance and fluency might be lower compared to later, more refined checkpoints.
131
+ - **Usage Recommendations:** Best suited for research and experimental purposes rather than production deployment without further fine-tuning.
132
+
133
+ ---
134
+
135
+ ## Training Data & Methodology
136
+
137
+ While detailed documentation on the training dataset and methods is available in the repository, this checkpoint represents an intermediate stage of training after 9B tokens. Users interested in the training process, dataset specifics, and additional checkpoints are encouraged to consult the [repository documentation](https://github.com/MedITSolutionsKurman/medit-one).
138
+
139
+ ---
140
+
141
+ ## Citation
142
+
143
+ If you use the Medit One model in your research or applications, please cite the repository:
144
+
145
+ ```
146
+ @misc{medit-one,
147
+ author = {MedITSolutionsKurman},
148
+ title = {MedIT One},
149
+ year = {202X},
150
+ publisher = {GitHub},
151
+ journal = {GitHub repository},
152
+ howpublished = {\url{https://github.com/MedITSolutionsKurman/medit-one}},
153
+ }
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Additional Information
159
+
160
+ For more details on installation, model training, and updates, please refer to the repository's README and documentation. Contributions and feedback are welcome from the community.