Instructions to use viklofg/swedish-ocr-correction with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use viklofg/swedish-ocr-correction with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("viklofg/swedish-ocr-correction") model = AutoModelForSeq2SeqLM.from_pretrained("viklofg/swedish-ocr-correction", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -14,13 +14,7 @@ widget:
|
|
| 14 |
|
| 15 |
# Swedish OCR correction
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
This model corrects OCR errors in Swedish text.
|
| 20 |
-
|
| 21 |
-
## Try it!
|
| 22 |
-
- On short texts in the inference widget to the right ->
|
| 23 |
-
- On files or longer texts in the [demo](https://huggingface.co/spaces/viklofg/swedish-ocr-correction-demo)
|
| 24 |
|
| 25 |
## Model Description
|
| 26 |
|
|
@@ -28,25 +22,6 @@ This model is a fine-tuned version of [byt5-small](https://huggingface.co/google
|
|
| 28 |
The fine-tuning data consists of OCR samples from Swedish newspapers and historical documents.
|
| 29 |
The model works on texts up to 128 UTF-8 bytes (see [Length limit](#length-limit)).
|
| 30 |
|
| 31 |
-
<!-- ### Model Description-->
|
| 32 |
-
|
| 33 |
-
<!-- Provide a longer summary of what this model is.
|
| 34 |
-
|
| 35 |
-
- **Developed by:** [More Information Needed]
|
| 36 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 37 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 38 |
-
- **Model type:** [More Information Needed]
|
| 39 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 40 |
-
- **License:** [More Information Needed]
|
| 41 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 42 |
-
|
| 43 |
-
### Model Sources [optional]
|
| 44 |
-
|
| 45 |
-
- **Repository:** [More Information Needed]
|
| 46 |
-
- **Paper [optional]:** [More Information Needed]
|
| 47 |
-
- **Demo [optional]:** [More Information Needed]-->
|
| 48 |
-
|
| 49 |
-
|
| 50 |
## Training Data
|
| 51 |
|
| 52 |
The base model byt5 is pre-trained on [mc4](https://huggingface.co/datasets/mc4). This fine-tuned version is further trained on:
|
|
@@ -55,7 +30,6 @@ The base model byt5 is pre-trained on [mc4](https://huggingface.co/datasets/mc4)
|
|
| 55 |
- Swedish blackletter documents from 1626 to 1816, available from Språkbaknen Text: [Swedish fraktur 1626-1816](https://spraakbanken.gu.se/resurser/svensk-fraktur-1626-1816)
|
| 56 |
|
| 57 |
This data includes characters not used in Swedish today, such as the long s (ſ) and the esszett ligature (ß), which means that the model should be able to handle texts with these characters.
|
| 58 |
-
See for example the example titled _Long-s piano ad_ in the inference widget to the right.
|
| 59 |
|
| 60 |
## Usage
|
| 61 |
Use the code below to get started with the model.
|
|
@@ -73,5 +47,6 @@ print(output)
|
|
| 73 |
```
|
| 74 |
|
| 75 |
### Length limit
|
| 76 |
-
The model accepts input sequences of at most 128 UTF-8 bytes, longer sequences are truncated to this limit.
|
|
|
|
| 77 |
|
|
|
|
| 14 |
|
| 15 |
# Swedish OCR correction
|
| 16 |
|
| 17 |
+
This model corrects OCR errors in historical Swedish text.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
## Model Description
|
| 20 |
|
|
|
|
| 22 |
The fine-tuning data consists of OCR samples from Swedish newspapers and historical documents.
|
| 23 |
The model works on texts up to 128 UTF-8 bytes (see [Length limit](#length-limit)).
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
## Training Data
|
| 26 |
|
| 27 |
The base model byt5 is pre-trained on [mc4](https://huggingface.co/datasets/mc4). This fine-tuned version is further trained on:
|
|
|
|
| 30 |
- Swedish blackletter documents from 1626 to 1816, available from Språkbaknen Text: [Swedish fraktur 1626-1816](https://spraakbanken.gu.se/resurser/svensk-fraktur-1626-1816)
|
| 31 |
|
| 32 |
This data includes characters not used in Swedish today, such as the long s (ſ) and the esszett ligature (ß), which means that the model should be able to handle texts with these characters.
|
|
|
|
| 33 |
|
| 34 |
## Usage
|
| 35 |
Use the code below to get started with the model.
|
|
|
|
| 47 |
```
|
| 48 |
|
| 49 |
### Length limit
|
| 50 |
+
The model accepts input sequences of at most 128 UTF-8 bytes, longer sequences are truncated to this limit.
|
| 51 |
+
128 UTF-8 bytes corresponds to slightly less than 128 characters of Swedish text since most characters are encoded as one byte, but non-ASCII characters such as Å, Ä, and Ö are encoded as two (or more) bytes.
|
| 52 |
|