Update README.md
Browse files
README.md
CHANGED
@@ -168,7 +168,12 @@ class IAMDataset(Dataset):
|
|
168 |
|
169 |
# Load the dataset
|
170 |
from transformers import TrOCRProcessor, AutoTokenizer
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
# Define the dataset
|
174 |
#Open the file with text lines
|
@@ -209,7 +214,8 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
209 |
|
210 |
from safetensors.torch import load_file
|
211 |
# Load the weights of this model
|
212 |
-
|
|
|
213 |
|
214 |
# Load the trocr model
|
215 |
model = VisionEncoderDecoderModel.from_pretrained("microsoft/trocr-large-handwritten")
|
|
|
168 |
|
169 |
# Load the dataset
|
170 |
from transformers import TrOCRProcessor, AutoTokenizer
|
171 |
+
|
172 |
+
# Download this model from Hugging Face Hub
|
173 |
+
model_path = hf_hub_download(repo_id="magistermilitum/tridis_v2_HTR_historical_manuscripts")
|
174 |
+
|
175 |
+
#Load the processor from the model
|
176 |
+
processor = TrOCRProcessor.from_pretrained(model_path)
|
177 |
|
178 |
# Define the dataset
|
179 |
#Open the file with text lines
|
|
|
214 |
|
215 |
from safetensors.torch import load_file
|
216 |
# Load the weights of this model
|
217 |
+
safetensors_path = f"{model_path}/model.safetensors"
|
218 |
+
state_dict = load_file(safetensors_path)
|
219 |
|
220 |
# Load the trocr model
|
221 |
model = VisionEncoderDecoderModel.from_pretrained("microsoft/trocr-large-handwritten")
|