yahya-khoder commited on
Commit
dd0dadd
·
1 Parent(s): 87b1239

MD 2 JSON with T5 small

Browse files
README.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MD2JSON-T5-V1: Text-to-JSON Converter with T5
2
+
3
+ This model utilizes the **T5 (Text-to-Text Transfer Transformer)** architecture to convert text strings into valid JSON objects. It is designed to take structured text and transform it into a JSON object.
4
+
5
+ ## Description
6
+
7
+ The **MD2JSON-T5-V1** model is trained to interpret text strings where keys and values are separated by a colon (e.g., `#firstname: John`), and then convert them into a valid JSON object. This model can be used for a wide range of tasks where converting text to JSON is required.
8
+
9
+ ### Example Input:
10
+ - Input:
11
+ ```text
12
+ #firstname: John
13
+ #lastname: Doe
14
+ #age: 30
15
+ #married: true
16
+ #hobbies: ["gaming", "running"]
17
+ #address: {"city": "Berlin", "zipcode": 10115}
18
+ #url: "https://example.com"
19
+ ```
20
+
21
+ - Generated JSON Output:
22
+ ```json
23
+ {
24
+ "firstname": "John",
25
+ "lastname": "Doe",
26
+ "age": 30,
27
+ "married": true,
28
+ "hobbies": ["gaming", "running"],
29
+ "address": {
30
+ "city": "Berlin",
31
+ "zipcode": 10115
32
+ },
33
+ "url": "https://example.com"
34
+ }
35
+ ```
36
+
37
+ ### Another Example:
38
+ - Input:
39
+ ```text
40
+ #name: Charlie
41
+ #age: 29
42
+ #isStudent: true
43
+ #skills: ["Java", "Machine Learning"]
44
+ #profile: {"github": "charlie29", "linkedin": "charlie-linkedin"}
45
+ #height: 172.3
46
+ ```
47
+
48
+ - Generated JSON Output:
49
+ ```json
50
+ {
51
+ "name": "Charlie",
52
+ "age": 29,
53
+ "isStudent": true,
54
+ "skills": ["Java", "Machine Learning"],
55
+ "profile": {
56
+ "github": "charlie29",
57
+ "linkedin": "charlie-linkedin"
58
+ },
59
+ "height": 172.3
60
+ }
61
+ ```
62
+
63
+ ## Load the Model
64
+
65
+ To use the model and perform inference, follow the steps below:
66
+
67
+ ### Install Dependencies
68
+
69
+ ```bash
70
+ pip install torch transformers datasets
71
+
config.json ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "t5-small",
3
+ "architectures": [
4
+ "T5ForConditionalGeneration"
5
+ ],
6
+ "classifier_dropout": 0.0,
7
+ "d_ff": 2048,
8
+ "d_kv": 64,
9
+ "d_model": 512,
10
+ "decoder_start_token_id": 0,
11
+ "dense_act_fn": "relu",
12
+ "dropout_rate": 0.1,
13
+ "eos_token_id": 1,
14
+ "feed_forward_proj": "relu",
15
+ "initializer_factor": 1.0,
16
+ "is_encoder_decoder": true,
17
+ "is_gated_act": false,
18
+ "layer_norm_epsilon": 1e-06,
19
+ "model_type": "t5",
20
+ "n_positions": 512,
21
+ "num_decoder_layers": 6,
22
+ "num_heads": 8,
23
+ "num_layers": 6,
24
+ "output_past": true,
25
+ "pad_token_id": 0,
26
+ "relative_attention_max_distance": 128,
27
+ "relative_attention_num_buckets": 32,
28
+ "task_specific_params": {
29
+ "summarization": {
30
+ "early_stopping": true,
31
+ "length_penalty": 2.0,
32
+ "max_length": 200,
33
+ "min_length": 30,
34
+ "no_repeat_ngram_size": 3,
35
+ "num_beams": 4,
36
+ "prefix": "summarize: "
37
+ },
38
+ "translation_en_to_de": {
39
+ "early_stopping": true,
40
+ "max_length": 300,
41
+ "num_beams": 4,
42
+ "prefix": "translate English to German: "
43
+ },
44
+ "translation_en_to_fr": {
45
+ "early_stopping": true,
46
+ "max_length": 300,
47
+ "num_beams": 4,
48
+ "prefix": "translate English to French: "
49
+ },
50
+ "translation_en_to_ro": {
51
+ "early_stopping": true,
52
+ "max_length": 300,
53
+ "num_beams": 4,
54
+ "prefix": "translate English to Romanian: "
55
+ }
56
+ },
57
+ "torch_dtype": "float32",
58
+ "transformers_version": "4.47.1",
59
+ "use_cache": true,
60
+ "vocab_size": 32128
61
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "decoder_start_token_id": 0,
4
+ "eos_token_id": 1,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "4.47.1"
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c7347a0168f05074991fb6713e04ec84dba64e0467ab0fbeca9f062ce8a81e9
3
+ size 242041896
optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:47aa9fc06bb7be77be36d5b2141aafdfa79160d1335b92af37270b5777ac1811
3
+ size 484159866
rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dbf11243288a5c23a3ff457eb797018d98049d17a92086a1b2f6131f32cc6fa6
3
+ size 13990
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2128056c0e422c6e1201ad40cceec048820717e61f000141d547bd956d6b7131
3
+ size 1064
trainer_state.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 3.0,
5
+ "eval_steps": 50,
6
+ "global_step": 3,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [],
11
+ "logging_steps": 20,
12
+ "max_steps": 3,
13
+ "num_input_tokens_seen": 0,
14
+ "num_train_epochs": 3,
15
+ "save_steps": 500,
16
+ "stateful_callbacks": {
17
+ "TrainerControl": {
18
+ "args": {
19
+ "should_epoch_stop": false,
20
+ "should_evaluate": false,
21
+ "should_log": false,
22
+ "should_save": true,
23
+ "should_training_stop": true
24
+ },
25
+ "attributes": {}
26
+ }
27
+ },
28
+ "total_flos": 812050808832.0,
29
+ "train_batch_size": 8,
30
+ "trial_name": null,
31
+ "trial_params": null
32
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:92bb76d3e0c05f47eddf1629ac30c18510adf5139cf3fdf8ae1cc76e1fd7a14e
3
+ size 5304