ketanmore commited on
Commit
69ef53f
1 Parent(s): 943b17e

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +45 -0
  2. config.json +80 -0
  3. model.safetensors +3 -0
README.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Here's how the README file for your `surya-ocr-arabic` model could look:
2
+
3
+ ---
4
+
5
+ # Surya OCR Arabic
6
+
7
+ This repository contains the `surya-ocr-arabic` model, which is based on a modified SegFormer architecture. The model was fine-tuned for document layout detection tasks.
8
+
9
+
10
+ ## Setup Instructions
11
+
12
+ ### Clone the Surya OCR GitHub Repository
13
+
14
+ To use the `SegformerForRegressionMask` class, you need to clone the Surya OCR GitHub repository:
15
+
16
+ ```bash
17
+ git clone https://github.com/vikp/surya_.git
18
+ cd surya
19
+ ```
20
+
21
+ ### Switch to v0.4.14
22
+
23
+ ```bash
24
+ git checkout f7c6c04
25
+ ```
26
+
27
+ ### Install Dependencies
28
+
29
+ You can install the required dependencies using the following command:
30
+
31
+ ```bash
32
+ pip install -r requirements.txt
33
+ ```
34
+
35
+ ### Import and Use the Model
36
+
37
+ You can load and use the `surya-ocr-arabic` model as follows:
38
+
39
+ ```python
40
+ from surya.surya.model.detection.segformer import SegformerForRegressionMask
41
+ import torch
42
+
43
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
44
+ model = SegformerForRegressionMask.from_pretrained("ketanmore/surya-ocr-arabic-segment", torch_dtype=torch.float32).to(device)
45
+ ```
config.json ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "vikp/surya_det2",
3
+ "architectures": [
4
+ "SegformerForRegressionMask"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "classifier_dropout_prob": 0.1,
8
+ "decoder_hidden_size": 768,
9
+ "decoder_layer_hidden_size": 192,
10
+ "decoder_upsample_rate": 2,
11
+ "depths": [
12
+ 3,
13
+ 4,
14
+ 9,
15
+ 3
16
+ ],
17
+ "downsampling_rates": [
18
+ 1,
19
+ 4,
20
+ 8,
21
+ 16
22
+ ],
23
+ "drop_path_rate": 0.1,
24
+ "hidden_act": "gelu",
25
+ "hidden_dropout_prob": 0.0,
26
+ "hidden_sizes": [
27
+ 64,
28
+ 128,
29
+ 320,
30
+ 512
31
+ ],
32
+ "id2label": {
33
+ "0": "blank",
34
+ "1": "text"
35
+ },
36
+ "image_size": 224,
37
+ "initializer_range": 0.02,
38
+ "label2id": {
39
+ "blank": 0,
40
+ "text": 1
41
+ },
42
+ "layer_norm_eps": 1e-06,
43
+ "mlp_ratios": [
44
+ 4,
45
+ 4,
46
+ 4,
47
+ 4
48
+ ],
49
+ "model_type": "segformer",
50
+ "num_attention_heads": [
51
+ 1,
52
+ 2,
53
+ 5,
54
+ 8
55
+ ],
56
+ "num_channels": 3,
57
+ "num_encoder_blocks": 4,
58
+ "patch_sizes": [
59
+ 7,
60
+ 3,
61
+ 3,
62
+ 3
63
+ ],
64
+ "reshape_last_stage": true,
65
+ "semantic_loss_ignore_index": -1,
66
+ "sr_ratios": [
67
+ 8,
68
+ 4,
69
+ 2,
70
+ 1
71
+ ],
72
+ "strides": [
73
+ 4,
74
+ 2,
75
+ 2,
76
+ 2
77
+ ],
78
+ "torch_dtype": "float32",
79
+ "transformers_version": "4.44.0"
80
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0ea4e8d36542029f2398ee982cfca61aa43a8ada62f64a099868aa0d157ef35
3
+ size 119881240