magistermilitum commited on
Commit
92d96af
·
verified ·
1 Parent(s): 10e14a3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +8 -2
README.md CHANGED
@@ -168,7 +168,12 @@ class IAMDataset(Dataset):
168
 
169
  # Load the dataset
170
  from transformers import TrOCRProcessor, AutoTokenizer
171
- processor = TrOCRProcessor.from_pretrained("magistermilitum/tridis_v2_HTR_historical_manuscripts") #change to this model
 
 
 
 
 
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
- state_dict= load_file("tridis_v2_HTR_historical_manuscripts/model.safetensors")
 
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")