Python 3.10.15requirements.txt file using,
pip install -r requirements.txt src/checkpoints
src/models/det_model/model/directorydet/ or rec/ directories within src/models/third_party/paddleocr/checkpoints/, and rename them to default_model.onnx. cd src
./start_web.sh
latex_rec_model = TexTeller.from_pretrained('checkpoints/checkpoint_for_text')
in the inference.py filepython inference.py -img "/path/to/image.{jpg,png}"
python inference.py -img "/path/to/image.{jpg,png}" -grammar
We provide an example dataset in the src/models/ocr_model/train/dataset/ directory, you can place your own images in the images/ directory and annotate each image with its corresponding formula in formulas.jsonl.
After preparing your dataset, you need to change the DIR_URL variable to your own dataset's path in **/train/dataset/loader.py
Modify num_processes in src/train_config.yaml to match the number of GPUs available for training (default is 1).
In the src/ directory, run the following command:
accelerate launch --config_file ./train_config.yaml -m models.ocr_model.train.train
You can set your own tokenizer and checkpoint paths in src/models/ocr_model/train/train.py (refer to train.py for more information). If you are using the same architecture and vocabulary as Ink2Text, you can also fine-tune Ink2Text's default weights with your own dataset.
12 commits
Python
98.3%
Jupyter Notebook
1.3%
Python 3.10.15requirements.txt file using,
pip install -r requirements.txt src/checkpoints
src/models/det_model/model/directorydet/ or rec/ directories within src/models/third_party/paddleocr/checkpoints/, and rename them to default_model.onnx. cd src
./start_web.sh
latex_rec_model = TexTeller.from_pretrained('checkpoints/checkpoint_for_text')
in the inference.py filepython inference.py -img "/path/to/image.{jpg,png}"
python inference.py -img "/path/to/image.{jpg,png}" -grammar
We provide an example dataset in the src/models/ocr_model/train/dataset/ directory, you can place your own images in the images/ directory and annotate each image with its corresponding formula in formulas.jsonl.
After preparing your dataset, you need to change the DIR_URL variable to your own dataset's path in **/train/dataset/loader.py
Modify num_processes in src/train_config.yaml to match the number of GPUs available for training (default is 1).
In the src/ directory, run the following command:
accelerate launch --config_file ./train_config.yaml -m models.ocr_model.train.train
You can set your own tokenizer and checkpoint paths in src/models/ocr_model/train/train.py (refer to train.py for more information). If you are using the same architecture and vocabulary as Ink2Text, you can also fine-tune Ink2Text's default weights with your own dataset.
12 commits
Python
98.3%
Jupyter Notebook
1.3%