KoichiYasuoka commited on
Commit
f156762
1 Parent(s): cd44edc

model improved for transformers 4.42

Browse files
config.json CHANGED
@@ -4,22 +4,11 @@
4
  ],
5
  "attention_bias": false,
6
  "attention_dropout": 0.0,
7
- "auto_map": {
8
- "AutoModelForTokenClassification": "upos.LlamaForTokenClassification"
9
- },
10
  "bos_token_id": 1,
11
  "custom_pipelines": {
12
  "upos": {
13
  "impl": "upos.BellmanFordTokenClassificationPipeline",
14
  "pt": "AutoModelForTokenClassification"
15
- },
16
- "token-classification": {
17
- "impl": "upos.RawTokenClassificationPipeline",
18
- "pt": "AutoModelForTokenClassification"
19
- },
20
- "ner": {
21
- "impl": "upos.RawTokenClassificationPipeline",
22
- "pt": "AutoModelForTokenClassification"
23
  }
24
  },
25
  "eos_token_id": 2,
@@ -153,6 +142,7 @@
153
  },
154
  "max_position_embeddings": 4096,
155
  "max_sequence_length": 4096,
 
156
  "model_type": "llama",
157
  "num_attention_heads": 32,
158
  "num_hidden_layers": 32,
@@ -165,7 +155,7 @@
165
  "tie_word_embeddings": false,
166
  "tokenizer_class": "LlamaTokenizerFast",
167
  "torch_dtype": "float32",
168
- "transformers_version": "4.38.1",
169
  "use_cache": true,
170
  "vocab_size": 43744
171
  }
 
4
  ],
5
  "attention_bias": false,
6
  "attention_dropout": 0.0,
 
 
 
7
  "bos_token_id": 1,
8
  "custom_pipelines": {
9
  "upos": {
10
  "impl": "upos.BellmanFordTokenClassificationPipeline",
11
  "pt": "AutoModelForTokenClassification"
 
 
 
 
 
 
 
 
12
  }
13
  },
14
  "eos_token_id": 2,
 
142
  },
143
  "max_position_embeddings": 4096,
144
  "max_sequence_length": 4096,
145
+ "mlp_bias": false,
146
  "model_type": "llama",
147
  "num_attention_heads": 32,
148
  "num_hidden_layers": 32,
 
155
  "tie_word_embeddings": false,
156
  "tokenizer_class": "LlamaTokenizerFast",
157
  "torch_dtype": "float32",
158
+ "transformers_version": "4.42.4",
159
  "use_cache": true,
160
  "vocab_size": 43744
161
  }
maker.sh CHANGED
@@ -48,45 +48,9 @@ cat << 'EOF' > $TMPB
48
  #! /usr/bin/env deepspeed
49
  src="exSwallow-7b-plus-hf"
50
  tgt="KoichiYasuoka/Swallow-7b-plus-upos"
51
- from transformers import LlamaTokenizerFast,LlamaModel,LlamaPreTrainedModel,AutoConfig,DataCollatorForTokenClassification,TrainingArguments,Trainer
52
- from transformers.modeling_outputs import TokenClassifierOutput
53
  from tokenizers.normalizers import Replace
54
 
55
- class LlamaForTokenClassification(LlamaPreTrainedModel):
56
- def __init__(self,config):
57
- from torch import nn
58
- super().__init__(config)
59
- self.num_labels=config.num_labels
60
- self.model=LlamaModel(config)
61
- if hasattr(config,"classifier_dropout") and config.classifier_dropout is not None:
62
- classifier_dropout=config.classifier_dropout
63
- elif hasattr(config,"hidden_dropout") and config.hidden_dropout is not None:
64
- classifier_dropout=config.hidden_dropout
65
- else:
66
- classifier_dropout=0.1
67
- self.dropout=nn.Dropout(classifier_dropout)
68
- self.classifier=nn.Linear(config.hidden_size,config.num_labels)
69
- self.post_init()
70
- def get_input_embeddings(self):
71
- return self.model.embed_tokens
72
- def set_input_embeddings(self,value):
73
- self.model.embed_tokens=value
74
- def forward(self,input_ids=None,past_key_values=None,attention_mask=None,position_ids=None,inputs_embeds=None,labels=None,use_cache=None,output_attentions=None,output_hidden_states=None,return_dict=None):
75
- return_dict=return_dict if return_dict is not None else self.config.use_return_dict
76
- transformer_outputs=self.model(input_ids,past_key_values=past_key_values,attention_mask=attention_mask,position_ids=position_ids,inputs_embeds=inputs_embeds,use_cache=use_cache,output_attentions=output_attentions,output_hidden_states=output_hidden_states,return_dict=return_dict)
77
- hidden_states=transformer_outputs[0]
78
- hidden_states=self.dropout(hidden_states)
79
- logits=self.classifier(hidden_states)
80
- loss=None
81
- if labels is not None:
82
- from torch import nn
83
- loss_fct=nn.CrossEntropyLoss()
84
- loss=loss_fct(logits.view(-1,self.num_labels),labels.view(-1))
85
- if not return_dict:
86
- output=(logits,)+transformer_outputs[2:]
87
- return ((loss,)+output) if loss is not None else output
88
- return TokenClassifierOutput(loss=loss,logits=logits,hidden_states=transformer_outputs.hidden_states,attentions=transformer_outputs.attentions)
89
-
90
  class UPOSFileDataset(object):
91
  def __init__(self,conllu,tokenizer):
92
  self.conllu=open(conllu,"r",encoding="utf-8")
 
48
  #! /usr/bin/env deepspeed
49
  src="exSwallow-7b-plus-hf"
50
  tgt="KoichiYasuoka/Swallow-7b-plus-upos"
51
+ from transformers import LlamaTokenizerFast,LlamaForTokenClassification,AutoConfig,DataCollatorForTokenClassification,TrainingArguments,Trainer
 
52
  from tokenizers.normalizers import Replace
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  class UPOSFileDataset(object):
55
  def __init__(self,conllu,tokenizer):
56
  self.conllu=open(conllu,"r",encoding="utf-8")
pytorch_model-00001-of-00006.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:febbf717e4d094a9f32b65b84a0dc1e76d671b6c09dd22e1729ea30cc1e72f26
3
  size 4965712452
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15b7ecb40dc994c01d584b8f6061aafb937adb91d3ea88d190874393ef152b77
3
  size 4965712452
pytorch_model-00002-of-00006.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0df6860eb51bbd2ab136351a39f295d4a2853a74a7719e1ea83a296b0af3e9d1
3
  size 4924328556
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ee7cc71f1d19b1403f8f7fdefee9c2fdc7db7fb2d793fb1676bd9440335cc78
3
  size 4924328556
pytorch_model-00003-of-00006.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e9680466f58012f08f43e5f12372f3d48769f70e387debe22aaefba6d154682f
3
  size 4857219294
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:504a5638d62594b8c0025a56083668458291dcd1137455a403efa35093b7c15c
3
  size 4857219294
pytorch_model-00004-of-00006.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:161461dcdc9717b80393bfa008d903aaa92122f584fb287047d4e78b2c68433a
3
  size 4857219294
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1e030bf6ba8296546621ba35acdc1486c0695b500141aa20f242bbc514002a2
3
  size 4857219294
pytorch_model-00005-of-00006.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5dbfcec466897e051cbcf40dff7961a632a3836e68ae494edb2ce90e94a920f0
3
  size 4857219294
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c068f31f763a9235aeef0f60407db1fb5ffde971ede030ccf9787eb7490bb8d8
3
  size 4857219294
pytorch_model-00006-of-00006.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1c75d142cb23ea767435988d9cff5daca87f8f22b2755b4424cfc9aa9a7f78df
3
  size 2161173694
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4fb6cbefff2a23a4edc4414e8b48e6d7d336f9cb4e3338fe21b55273bd827dff
3
  size 2161173694
pytorch_model.bin.index.json CHANGED
@@ -3,8 +3,6 @@
3
  "total_size": 26622771440
4
  },
5
  "weight_map": {
6
- "classifier.bias": "pytorch_model-00006-of-00006.bin",
7
- "classifier.weight": "pytorch_model-00006-of-00006.bin",
8
  "model.embed_tokens.weight": "pytorch_model-00001-of-00006.bin",
9
  "model.layers.0.input_layernorm.weight": "pytorch_model-00001-of-00006.bin",
10
  "model.layers.0.mlp.down_proj.weight": "pytorch_model-00001-of-00006.bin",
@@ -294,6 +292,8 @@
294
  "model.layers.9.self_attn.o_proj.weight": "pytorch_model-00002-of-00006.bin",
295
  "model.layers.9.self_attn.q_proj.weight": "pytorch_model-00002-of-00006.bin",
296
  "model.layers.9.self_attn.v_proj.weight": "pytorch_model-00002-of-00006.bin",
297
- "model.norm.weight": "pytorch_model-00006-of-00006.bin"
 
 
298
  }
299
  }
 
3
  "total_size": 26622771440
4
  },
5
  "weight_map": {
 
 
6
  "model.embed_tokens.weight": "pytorch_model-00001-of-00006.bin",
7
  "model.layers.0.input_layernorm.weight": "pytorch_model-00001-of-00006.bin",
8
  "model.layers.0.mlp.down_proj.weight": "pytorch_model-00001-of-00006.bin",
 
292
  "model.layers.9.self_attn.o_proj.weight": "pytorch_model-00002-of-00006.bin",
293
  "model.layers.9.self_attn.q_proj.weight": "pytorch_model-00002-of-00006.bin",
294
  "model.layers.9.self_attn.v_proj.weight": "pytorch_model-00002-of-00006.bin",
295
+ "model.norm.weight": "pytorch_model-00006-of-00006.bin",
296
+ "score.bias": "pytorch_model-00006-of-00006.bin",
297
+ "score.weight": "pytorch_model-00006-of-00006.bin"
298
  }
299
  }
tokenizer.json CHANGED
@@ -38,7 +38,12 @@
38
  },
39
  "content": "▁"
40
  },
41
- "pre_tokenizer": null,
 
 
 
 
 
42
  "post_processor": {
43
  "type": "TemplateProcessing",
44
  "single": [
@@ -125,6 +130,7 @@
125
  "end_of_word_suffix": null,
126
  "fuse_unk": true,
127
  "byte_fallback": false,
 
128
  "vocab": {
129
  "<unk>": 0,
130
  "<s>": 1,
@@ -43302,574 +43308,574 @@
43302
  "趙": 43173,
43303
  "弛": 43174,
43304
  "徊": 43175,
43305
- "": 43176,
43306
- "": 43177,
43307
- "": 43178,
43308
- "": 43179,
43309
- "": 43180,
43310
- "": 43181,
43311
- "": 43182,
43312
- "": 43183,
43313
- "": 43184,
43314
- "": 43185,
43315
- "": 43186,
43316
- "": 43187,
43317
- "": 43188,
43318
- "": 43189,
43319
- "": 43190,
43320
- "": 43191,
43321
- "": 43192,
43322
- "": 43193,
43323
- "": 43194,
43324
- "": 43195,
43325
- "": 43196,
43326
- "": 43197,
43327
- "": 43198,
43328
- "": 43199,
43329
- "": 43200,
43330
- "": 43201,
43331
- "": 43202,
43332
- "": 43203,
43333
- "": 43204,
43334
- "": 43205,
43335
- "": 43206,
43336
- "": 43207,
43337
- "": 43208,
43338
- "": 43209,
43339
- "": 43210,
43340
- "": 43211,
43341
- "": 43212,
43342
- "": 43213,
43343
- "": 43214,
43344
- "": 43215,
43345
- "": 43216,
43346
- "": 43217,
43347
- "": 43218,
43348
- "": 43219,
43349
- "": 43220,
43350
- "": 43221,
43351
- "": 43222,
43352
- "": 43223,
43353
- "": 43224,
43354
- "": 43225,
43355
- "": 43226,
43356
- "": 43227,
43357
- "": 43228,
43358
- "": 43229,
43359
- "": 43230,
43360
- "": 43231,
43361
- "": 43232,
43362
- "": 43233,
43363
- "": 43234,
43364
- "": 43235,
43365
- "": 43236,
43366
- "": 43237,
43367
- "": 43238,
43368
- "": 43239,
43369
- "": 43240,
43370
- "": 43241,
43371
- "": 43242,
43372
- "": 43243,
43373
- "": 43244,
43374
- "": 43245,
43375
- "": 43246,
43376
- "": 43247,
43377
- "": 43248,
43378
- "": 43249,
43379
- "": 43250,
43380
- "": 43251,
43381
- "": 43252,
43382
- "": 43253,
43383
- "": 43254,
43384
- "": 43255,
43385
- "": 43256,
43386
- "": 43257,
43387
- "": 43258,
43388
- "": 43259,
43389
- "": 43260,
43390
- "": 43261,
43391
- "": 43262,
43392
- "": 43263,
43393
- "": 43264,
43394
- "": 43265,
43395
- "": 43266,
43396
- "": 43267,
43397
- "": 43268,
43398
- "": 43269,
43399
- "": 43270,
43400
- "": 43271,
43401
- "": 43272,
43402
- "": 43273,
43403
- "": 43274,
43404
- "": 43275,
43405
- "": 43276,
43406
- "": 43277,
43407
- "": 43278,
43408
- "": 43279,
43409
- "": 43280,
43410
- "": 43281,
43411
- "": 43282,
43412
- "": 43283,
43413
- "": 43284,
43414
- "麿": 43285,
43415
- "": 43286,
43416
- "": 43287,
43417
- "": 43288,
43418
- "": 43289,
43419
- "": 43290,
43420
- "": 43291,
43421
- "": 43292,
43422
- "": 43293,
43423
- "": 43294,
43424
- "": 43295,
43425
- "": 43296,
43426
- "": 43297,
43427
- "": 43298,
43428
- "": 43299,
43429
- "": 43300,
43430
- "": 43301,
43431
- "": 43302,
43432
- "": 43303,
43433
- "": 43304,
43434
- "": 43305,
43435
- "": 43306,
43436
- "": 43307,
43437
- "": 43308,
43438
- "": 43309,
43439
- "": 43310,
43440
- "": 43311,
43441
- "": 43312,
43442
- "": 43313,
43443
- "": 43314,
43444
- "": 43315,
43445
- "𠮟": 43316,
43446
- "": 43317,
43447
- "": 43318,
43448
- "": 43319,
43449
- "": 43320,
43450
- "": 43321,
43451
- "": 43322,
43452
- "": 43323,
43453
- "": 43324,
43454
- "": 43325,
43455
- "": 43326,
43456
- "": 43327,
43457
- "": 43328,
43458
- "": 43329,
43459
- "": 43330,
43460
- "": 43331,
43461
- "": 43332,
43462
- "": 43333,
43463
- "": 43334,
43464
- "": 43335,
43465
- "": 43336,
43466
- "": 43337,
43467
- "": 43338,
43468
- "": 43339,
43469
- "": 43340,
43470
- "": 43341,
43471
- "": 43342,
43472
- "": 43343,
43473
- "": 43344,
43474
- "": 43345,
43475
- "": 43346,
43476
- "": 43347,
43477
- "": 43348,
43478
- "": 43349,
43479
- "": 43350,
43480
- "": 43351,
43481
- "": 43352,
43482
- "": 43353,
43483
- "": 43354,
43484
- "": 43355,
43485
- "": 43356,
43486
- "": 43357,
43487
- "": 43358,
43488
- "": 43359,
43489
- "": 43360,
43490
- "": 43361,
43491
- "": 43362,
43492
- "": 43363,
43493
- "": 43364,
43494
- "": 43365,
43495
- "": 43366,
43496
- "": 43367,
43497
- "": 43368,
43498
- "": 43369,
43499
- "": 43370,
43500
- "": 43371,
43501
- "": 43372,
43502
- "": 43373,
43503
- "": 43374,
43504
- "": 43375,
43505
- "": 43376,
43506
- "": 43377,
43507
- "": 43378,
43508
- "": 43379,
43509
- "": 43380,
43510
- "": 43381,
43511
- "": 43382,
43512
- "": 43383,
43513
- "": 43384,
43514
- "": 43385,
43515
- "": 43386,
43516
- "": 43387,
43517
- "": 43388,
43518
- "": 43389,
43519
- "": 43390,
43520
- "": 43391,
43521
- "": 43392,
43522
- "": 43393,
43523
- "": 43394,
43524
- "": 43395,
43525
- "": 43396,
43526
- "": 43397,
43527
- "": 43398,
43528
- "": 43399,
43529
- "": 43400,
43530
- "": 43401,
43531
- "": 43402,
43532
- "": 43403,
43533
- "": 43404,
43534
- "": 43405,
43535
- "": 43406,
43536
- "": 43407,
43537
- "": 43408,
43538
- "": 43409,
43539
- "": 43410,
43540
- "": 43411,
43541
- "": 43412,
43542
- "": 43413,
43543
- "": 43414,
43544
- "": 43415,
43545
- "": 43416,
43546
- "": 43417,
43547
- "": 43418,
43548
- "": 43419,
43549
- "": 43420,
43550
- "": 43421,
43551
- "": 43422,
43552
- "": 43423,
43553
- "": 43424,
43554
- "": 43425,
43555
- "": 43426,
43556
- "": 43427,
43557
- "": 43428,
43558
- "": 43429,
43559
- "": 43430,
43560
- "": 43431,
43561
- "": 43432,
43562
- "": 43433,
43563
- "": 43434,
43564
- "": 43435,
43565
- "": 43436,
43566
- "": 43437,
43567
- "": 43438,
43568
- "": 43439,
43569
- "": 43440,
43570
- "": 43441,
43571
- "": 43442,
43572
- "": 43443,
43573
- "": 43444,
43574
- "": 43445,
43575
- "": 43446,
43576
- "": 43447,
43577
- "": 43448,
43578
- "": 43449,
43579
- "": 43450,
43580
- "": 43451,
43581
- "": 43452,
43582
- "": 43453,
43583
- "": 43454,
43584
- "": 43455,
43585
- "": 43456,
43586
- "": 43457,
43587
- "": 43458,
43588
- "": 43459,
43589
- "": 43460,
43590
- "": 43461,
43591
- "": 43462,
43592
- "": 43463,
43593
- "": 43464,
43594
  "鎭": 43465,
43595
- "": 43466,
43596
- "": 43467,
43597
- "": 43468,
43598
- "": 43469,
43599
- "": 43470,
43600
- "": 43471,
43601
- "": 43472,
43602
- "": 43473,
43603
- "": 43474,
43604
- "": 43475,
43605
- "": 43476,
43606
- "": 43477,
43607
- "": 43478,
43608
- "": 43479,
43609
- "": 43480,
43610
- "": 43481,
43611
- "": 43482,
43612
- "": 43483,
43613
- "": 43484,
43614
- "": 43485,
43615
- "": 43486,
43616
- "": 43487,
43617
- "": 43488,
43618
- "": 43489,
43619
- "": 43490,
43620
- "": 43491,
43621
- "": 43492,
43622
- "": 43493,
43623
- "": 43494,
43624
- "": 43495,
43625
- "": 43496,
43626
- "": 43497,
43627
- "": 43498,
43628
- "滿": 43499,
43629
- "": 43500,
43630
- "": 43501,
43631
- "": 43502,
43632
- "": 43503,
43633
- "": 43504,
43634
- "": 43505,
43635
- "": 43506,
43636
- "": 43507,
43637
- "": 43508,
43638
- "": 43509,
43639
- "": 43510,
43640
- "": 43511,
43641
- "": 43512,
43642
- "": 43513,
43643
- "": 43514,
43644
- "": 43515,
43645
- "": 43516,
43646
- "": 43517,
43647
- "": 43518,
43648
- "": 43519,
43649
- "": 43520,
43650
- "": 43521,
43651
- "": 43522,
43652
- "": 43523,
43653
- "": 43524,
43654
- "": 43525,
43655
- "": 43526,
43656
- "": 43527,
43657
- "": 43528,
43658
- "": 43529,
43659
- "": 43530,
43660
- "": 43531,
43661
- "": 43532,
43662
- "": 43533,
43663
- "": 43534,
43664
- "": 43535,
43665
- "": 43536,
43666
- "": 43537,
43667
- "": 43538,
43668
- "": 43539,
43669
- "": 43540,
43670
- "": 43541,
43671
- "": 43542,
43672
- "": 43543,
43673
- "": 43544,
43674
- "": 43545,
43675
- "": 43546,
43676
- "": 43547,
43677
- "": 43548,
43678
- "": 43549,
43679
- "": 43550,
43680
- "": 43551,
43681
- "": 43552,
43682
- "": 43553,
43683
- "": 43554,
43684
- "": 43555,
43685
- "": 43556,
43686
- "": 43557,
43687
- "": 43558,
43688
- "": 43559,
43689
- "": 43560,
43690
- "": 43561,
43691
- "": 43562,
43692
- "": 43563,
43693
- "": 43564,
43694
- "": 43565,
43695
- "": 43566,
43696
- "": 43567,
43697
- "": 43568,
43698
- "": 43569,
43699
- "": 43570,
43700
- "": 43571,
43701
- "": 43572,
43702
- "": 43573,
43703
- "": 43574,
43704
- "": 43575,
43705
- "": 43576,
43706
- "": 43577,
43707
- "": 43578,
43708
- "": 43579,
43709
- "婿": 43580,
43710
- "": 43581,
43711
- "": 43582,
43712
- "": 43583,
43713
- "": 43584,
43714
- "": 43585,
43715
- "": 43586,
43716
- "": 43587,
43717
- "": 43588,
43718
- "": 43589,
43719
- "": 43590,
43720
- "���": 43591,
43721
- "": 43592,
43722
- "": 43593,
43723
- "": 43594,
43724
- "": 43595,
43725
- "": 43596,
43726
- "": 43597,
43727
- "": 43598,
43728
- "": 43599,
43729
- "": 43600,
43730
- "": 43601,
43731
- "": 43602,
43732
- "": 43603,
43733
- "": 43604,
43734
- "": 43605,
43735
- "": 43606,
43736
- "": 43607,
43737
- "": 43608,
43738
- "": 43609,
43739
- "": 43610,
43740
- "": 43611,
43741
- "": 43612,
43742
- "": 43613,
43743
- "": 43614,
43744
- "": 43615,
43745
- "": 43616,
43746
- "": 43617,
43747
- "": 43618,
43748
- "": 43619,
43749
- "": 43620,
43750
- "": 43621,
43751
- "": 43622,
43752
- "": 43623,
43753
- "": 43624,
43754
- "": 43625,
43755
- "": 43626,
43756
- "": 43627,
43757
- "": 43628,
43758
- "": 43629,
43759
- "": 43630,
43760
- "": 43631,
43761
- "": 43632,
43762
- "": 43633,
43763
- "": 43634,
43764
- "": 43635,
43765
- "": 43636,
43766
- "": 43637,
43767
- "": 43638,
43768
- "": 43639,
43769
- "": 43640,
43770
- "": 43641,
43771
- "": 43642,
43772
- "": 43643,
43773
- "": 43644,
43774
- "": 43645,
43775
- "": 43646,
43776
- "": 43647,
43777
- "": 43648,
43778
- "": 43649,
43779
- "": 43650,
43780
- "": 43651,
43781
- "": 43652,
43782
- "": 43653,
43783
- "": 43654,
43784
- "": 43655,
43785
- "": 43656,
43786
- "": 43657,
43787
- "": 43658,
43788
- "": 43659,
43789
- "": 43660,
43790
- "": 43661,
43791
- "": 43662,
43792
- "": 43663,
43793
- "": 43664,
43794
- "": 43665,
43795
- "": 43666,
43796
- "": 43667,
43797
- "": 43668,
43798
- "": 43669,
43799
- "": 43670,
43800
- "": 43671,
43801
- "": 43672,
43802
- "": 43673,
43803
- "": 43674,
43804
- "": 43675,
43805
- "": 43676,
43806
- "": 43677,
43807
- "": 43678,
43808
- "": 43679,
43809
- "": 43680,
43810
- "": 43681,
43811
- "": 43682,
43812
- "": 43683,
43813
- "": 43684,
43814
- "忿": 43685,
43815
- "": 43686,
43816
- "": 43687,
43817
- "": 43688,
43818
- "": 43689,
43819
- "": 43690,
43820
- "": 43691,
43821
- "": 43692,
43822
- "": 43693,
43823
- "": 43694,
43824
- "": 43695,
43825
- "": 43696,
43826
- "": 43697,
43827
- "": 43698,
43828
- "": 43699,
43829
- "": 43700,
43830
- "": 43701,
43831
- "": 43702,
43832
- "": 43703,
43833
- "": 43704,
43834
- "": 43705,
43835
- "": 43706,
43836
- "": 43707,
43837
- "": 43708,
43838
- "": 43709,
43839
- "": 43710,
43840
- "": 43711,
43841
- "": 43712,
43842
- "": 43713,
43843
- "": 43714,
43844
- "": 43715,
43845
- "": 43716,
43846
- "": 43717,
43847
- "": 43718,
43848
- "": 43719,
43849
- "": 43720,
43850
- "": 43721,
43851
- "": 43722,
43852
- "": 43723,
43853
- "": 43724,
43854
- "": 43725,
43855
- "": 43726,
43856
- "": 43727,
43857
- "": 43728,
43858
- "": 43729,
43859
- "": 43730,
43860
- "": 43731,
43861
- "": 43732,
43862
- "": 43733,
43863
- "": 43734,
43864
- "": 43735,
43865
- "": 43736,
43866
- "": 43737,
43867
- "": 43738,
43868
- "": 43739,
43869
- "": 43740,
43870
- "": 43741,
43871
- "": 43742,
43872
- "": 43743
43873
  },
43874
  "merges": [
43875
  "▁ t",
@@ -115374,4 +115380,4 @@
115374
  "▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁▁"
115375
  ]
115376
  }
115377
- }
 
38
  },
39
  "content": "▁"
40
  },
41
+ "pre_tokenizer": {
42
+ "type": "Metaspace",
43
+ "replacement": "▁",
44
+ "prepend_scheme": "first",
45
+ "split": false
46
+ },
47
  "post_processor": {
48
  "type": "TemplateProcessing",
49
  "single": [
 
130
  "end_of_word_suffix": null,
131
  "fuse_unk": true,
132
  "byte_fallback": false,
133
+ "ignore_merges": false,
134
  "vocab": {
135
  "<unk>": 0,
136
  "<s>": 1,
 
43308
  "趙": 43173,
43309
  "弛": 43174,
43310
  "徊": 43175,
43311
+ "": 43176,
43312
+ "": 43177,
43313
+ "": 43178,
43314
+ "": 43179,
43315
+ "": 43180,
43316
+ "": 43181,
43317
+ "": 43182,
43318
+ "": 43183,
43319
+ "": 43184,
43320
+ "": 43185,
43321
+ "": 43186,
43322
+ "": 43187,
43323
+ "": 43188,
43324
+ "": 43189,
43325
+ "": 43190,
43326
+ "": 43191,
43327
+ "": 43192,
43328
+ "": 43193,
43329
+ "": 43194,
43330
+ "": 43195,
43331
+ "": 43196,
43332
+ "": 43197,
43333
+ "": 43198,
43334
+ "": 43199,
43335
+ "": 43200,
43336
+ "": 43201,
43337
+ "忿": 43202,
43338
+ "": 43203,
43339
+ "": 43204,
43340
+ "": 43205,
43341
+ "": 43206,
43342
+ "": 43207,
43343
+ "": 43208,
43344
+ "": 43209,
43345
+ "": 43210,
43346
+ "": 43211,
43347
+ "": 43212,
43348
+ "": 43213,
43349
+ "": 43214,
43350
+ "": 43215,
43351
+ "": 43216,
43352
+ "": 43217,
43353
+ "": 43218,
43354
+ "": 43219,
43355
+ "": 43220,
43356
+ "": 43221,
43357
+ "": 43222,
43358
+ "": 43223,
43359
+ "": 43224,
43360
+ "": 43225,
43361
+ "": 43226,
43362
+ "": 43227,
43363
+ "": 43228,
43364
+ "": 43229,
43365
+ "": 43230,
43366
+ "": 43231,
43367
+ "": 43232,
43368
+ "": 43233,
43369
+ "": 43234,
43370
+ "": 43235,
43371
+ "": 43236,
43372
+ "": 43237,
43373
+ "": 43238,
43374
+ "": 43239,
43375
+ "": 43240,
43376
+ "": 43241,
43377
+ "": 43242,
43378
+ "": 43243,
43379
+ "": 43244,
43380
+ "": 43245,
43381
+ "": 43246,
43382
+ "": 43247,
43383
+ "": 43248,
43384
+ "": 43249,
43385
+ "": 43250,
43386
+ "": 43251,
43387
+ "": 43252,
43388
+ "": 43253,
43389
+ "": 43254,
43390
+ "": 43255,
43391
+ "": 43256,
43392
+ "": 43257,
43393
+ "": 43258,
43394
+ "": 43259,
43395
+ "": 43260,
43396
+ "": 43261,
43397
+ "": 43262,
43398
+ "": 43263,
43399
+ "": 43264,
43400
+ "": 43265,
43401
+ "": 43266,
43402
+ "": 43267,
43403
+ "": 43268,
43404
+ "": 43269,
43405
+ "": 43270,
43406
+ "": 43271,
43407
+ "": 43272,
43408
+ "": 43273,
43409
+ "": 43274,
43410
+ "": 43275,
43411
+ "": 43276,
43412
+ "": 43277,
43413
+ "": 43278,
43414
+ "": 43279,
43415
+ "": 43280,
43416
+ "": 43281,
43417
+ "": 43282,
43418
+ "": 43283,
43419
+ "": 43284,
43420
+ "": 43285,
43421
+ "": 43286,
43422
+ "": 43287,
43423
+ "": 43288,
43424
+ "": 43289,
43425
+ "": 43290,
43426
+ "": 43291,
43427
+ "": 43292,
43428
+ "": 43293,
43429
+ "": 43294,
43430
+ "": 43295,
43431
+ "": 43296,
43432
+ "": 43297,
43433
+ "": 43298,
43434
+ "": 43299,
43435
+ "": 43300,
43436
+ "": 43301,
43437
+ "": 43302,
43438
+ "": 43303,
43439
+ "": 43304,
43440
+ "": 43305,
43441
+ "": 43306,
43442
+ "滿": 43307,
43443
+ "": 43308,
43444
+ "": 43309,
43445
+ "": 43310,
43446
+ "": 43311,
43447
+ "": 43312,
43448
+ "": 43313,
43449
+ "": 43314,
43450
+ "": 43315,
43451
+ "": 43316,
43452
+ "": 43317,
43453
+ "": 43318,
43454
+ "": 43319,
43455
+ "": 43320,
43456
+ "": 43321,
43457
+ "": 43322,
43458
+ "": 43323,
43459
+ "": 43324,
43460
+ "": 43325,
43461
+ "": 43326,
43462
+ "": 43327,
43463
+ "": 43328,
43464
+ "": 43329,
43465
+ "": 43330,
43466
+ "": 43331,
43467
+ "": 43332,
43468
+ "": 43333,
43469
+ "": 43334,
43470
+ "": 43335,
43471
+ "": 43336,
43472
+ "": 43337,
43473
+ "": 43338,
43474
+ "": 43339,
43475
+ "": 43340,
43476
+ "": 43341,
43477
+ "": 43342,
43478
+ "": 43343,
43479
+ "": 43344,
43480
+ "": 43345,
43481
+ "": 43346,
43482
+ "": 43347,
43483
+ "": 43348,
43484
+ "": 43349,
43485
+ "": 43350,
43486
+ "": 43351,
43487
+ "": 43352,
43488
+ "": 43353,
43489
+ "": 43354,
43490
+ "": 43355,
43491
+ "": 43356,
43492
+ "": 43357,
43493
+ "": 43358,
43494
+ "": 43359,
43495
+ "": 43360,
43496
+ "": 43361,
43497
+ "": 43362,
43498
+ "": 43363,
43499
+ "": 43364,
43500
+ "": 43365,
43501
+ "": 43366,
43502
+ "": 43367,
43503
+ "": 43368,
43504
+ "": 43369,
43505
+ "": 43370,
43506
+ "": 43371,
43507
+ "": 43372,
43508
+ "": 43373,
43509
+ "": 43374,
43510
+ "": 43375,
43511
+ "": 43376,
43512
+ "": 43377,
43513
+ "": 43378,
43514
+ "": 43379,
43515
+ "": 43380,
43516
+ "": 43381,
43517
+ "": 43382,
43518
+ "": 43383,
43519
+ "麿": 43384,
43520
+ "": 43385,
43521
+ "": 43386,
43522
+ "": 43387,
43523
+ "": 43388,
43524
+ "": 43389,
43525
+ "": 43390,
43526
+ "": 43391,
43527
+ "": 43392,
43528
+ "": 43393,
43529
+ "": 43394,
43530
+ "": 43395,
43531
+ "": 43396,
43532
+ "": 43397,
43533
+ "": 43398,
43534
+ "": 43399,
43535
+ "": 43400,
43536
+ "": 43401,
43537
+ "": 43402,
43538
+ "": 43403,
43539
+ "": 43404,
43540
+ "": 43405,
43541
+ "": 43406,
43542
+ "": 43407,
43543
+ "": 43408,
43544
+ "": 43409,
43545
+ "": 43410,
43546
+ "": 43411,
43547
+ "": 43412,
43548
+ "": 43413,
43549
+ "": 43414,
43550
+ "": 43415,
43551
+ "": 43416,
43552
+ "": 43417,
43553
+ "": 43418,
43554
+ "": 43419,
43555
+ "": 43420,
43556
+ "": 43421,
43557
+ "": 43422,
43558
+ "": 43423,
43559
+ "": 43424,
43560
+ "": 43425,
43561
+ "": 43426,
43562
+ "": 43427,
43563
+ "": 43428,
43564
+ "": 43429,
43565
+ "": 43430,
43566
+ "": 43431,
43567
+ "": 43432,
43568
+ "": 43433,
43569
+ "": 43434,
43570
+ "": 43435,
43571
+ "": 43436,
43572
+ "": 43437,
43573
+ "": 43438,
43574
+ "": 43439,
43575
+ "": 43440,
43576
+ "": 43441,
43577
+ "": 43442,
43578
+ "": 43443,
43579
+ "": 43444,
43580
+ "": 43445,
43581
+ "": 43446,
43582
+ "": 43447,
43583
+ "": 43448,
43584
+ "": 43449,
43585
+ "": 43450,
43586
+ "": 43451,
43587
+ "": 43452,
43588
+ "": 43453,
43589
+ "": 43454,
43590
+ "": 43455,
43591
+ "": 43456,
43592
+ "": 43457,
43593
+ "": 43458,
43594
+ "": 43459,
43595
+ "": 43460,
43596
+ "": 43461,
43597
+ "": 43462,
43598
+ "": 43463,
43599
+ "": 43464,
43600
  "鎭": 43465,
43601
+ "": 43466,
43602
+ "": 43467,
43603
+ "": 43468,
43604
+ "": 43469,
43605
+ "": 43470,
43606
+ "": 43471,
43607
+ "": 43472,
43608
+ "": 43473,
43609
+ "": 43474,
43610
+ "": 43475,
43611
+ "": 43476,
43612
+ "": 43477,
43613
+ "": 43478,
43614
+ "": 43479,
43615
+ "": 43480,
43616
+ "": 43481,
43617
+ "": 43482,
43618
+ "": 43483,
43619
+ "": 43484,
43620
+ "": 43485,
43621
+ "": 43486,
43622
+ "": 43487,
43623
+ "": 43488,
43624
+ "": 43489,
43625
+ "": 43490,
43626
+ "": 43491,
43627
+ "": 43492,
43628
+ "": 43493,
43629
+ "": 43494,
43630
+ "": 43495,
43631
+ "": 43496,
43632
+ "": 43497,
43633
+ "": 43498,
43634
+ "": 43499,
43635
+ "": 43500,
43636
+ "": 43501,
43637
+ "": 43502,
43638
+ "": 43503,
43639
+ "": 43504,
43640
+ "": 43505,
43641
+ "": 43506,
43642
+ "": 43507,
43643
+ "": 43508,
43644
+ "": 43509,
43645
+ "": 43510,
43646
+ "": 43511,
43647
+ "": 43512,
43648
+ "": 43513,
43649
+ "": 43514,
43650
+ "": 43515,
43651
+ "": 43516,
43652
+ "": 43517,
43653
+ "": 43518,
43654
+ "": 43519,
43655
+ "": 43520,
43656
+ "": 43521,
43657
+ "": 43522,
43658
+ "": 43523,
43659
+ "": 43524,
43660
+ "": 43525,
43661
+ "": 43526,
43662
+ "": 43527,
43663
+ "": 43528,
43664
+ "": 43529,
43665
+ "": 43530,
43666
+ "": 43531,
43667
+ "": 43532,
43668
+ "": 43533,
43669
+ "": 43534,
43670
+ "": 43535,
43671
+ "": 43536,
43672
+ "": 43537,
43673
+ "": 43538,
43674
+ "": 43539,
43675
+ "": 43540,
43676
+ "": 43541,
43677
+ "": 43542,
43678
+ "": 43543,
43679
+ "": 43544,
43680
+ "": 43545,
43681
+ "": 43546,
43682
+ "": 43547,
43683
+ "": 43548,
43684
+ "": 43549,
43685
+ "": 43550,
43686
+ "": 43551,
43687
+ "": 43552,
43688
+ "": 43553,
43689
+ "": 43554,
43690
+ "": 43555,
43691
+ "": 43556,
43692
+ "": 43557,
43693
+ "": 43558,
43694
+ "": 43559,
43695
+ "": 43560,
43696
+ "": 43561,
43697
+ "": 43562,
43698
+ "": 43563,
43699
+ "": 43564,
43700
+ "": 43565,
43701
+ "": 43566,
43702
+ "": 43567,
43703
+ "": 43568,
43704
+ "": 43569,
43705
+ "": 43570,
43706
+ "": 43571,
43707
+ "": 43572,
43708
+ "": 43573,
43709
+ "": 43574,
43710
+ "": 43575,
43711
+ "": 43576,
43712
+ "": 43577,
43713
+ "": 43578,
43714
+ "": 43579,
43715
+ "": 43580,
43716
+ "": 43581,
43717
+ "": 43582,
43718
+ "": 43583,
43719
+ "": 43584,
43720
+ "": 43585,
43721
+ "": 43586,
43722
+ "": 43587,
43723
+ "": 43588,
43724
+ "": 43589,
43725
+ "": 43590,
43726
+ "": 43591,
43727
+ "": 43592,
43728
+ "": 43593,
43729
+ "": 43594,
43730
+ "": 43595,
43731
+ "": 43596,
43732
+ "": 43597,
43733
+ "": 43598,
43734
+ "": 43599,
43735
+ "𠮟": 43600,
43736
+ "": 43601,
43737
+ "": 43602,
43738
+ "": 43603,
43739
+ "": 43604,
43740
+ "": 43605,
43741
+ "": 43606,
43742
+ "": 43607,
43743
+ "": 43608,
43744
+ "": 43609,
43745
+ "": 43610,
43746
+ "": 43611,
43747
+ "": 43612,
43748
+ "": 43613,
43749
+ "": 43614,
43750
+ "": 43615,
43751
+ "": 43616,
43752
+ "": 43617,
43753
+ "": 43618,
43754
+ "": 43619,
43755
+ "": 43620,
43756
+ "": 43621,
43757
+ "": 43622,
43758
+ "": 43623,
43759
+ "": 43624,
43760
+ "": 43625,
43761
+ "": 43626,
43762
+ "": 43627,
43763
+ "": 43628,
43764
+ "": 43629,
43765
+ "": 43630,
43766
+ "": 43631,
43767
+ "": 43632,
43768
+ "": 43633,
43769
+ "": 43634,
43770
+ "": 43635,
43771
+ "": 43636,
43772
+ "": 43637,
43773
+ "": 43638,
43774
+ "": 43639,
43775
+ "婿": 43640,
43776
+ "": 43641,
43777
+ "": 43642,
43778
+ "": 43643,
43779
+ "": 43644,
43780
+ "": 43645,
43781
+ "": 43646,
43782
+ "": 43647,
43783
+ "": 43648,
43784
+ "": 43649,
43785
+ "": 43650,
43786
+ "": 43651,
43787
+ "": 43652,
43788
+ "": 43653,
43789
+ "": 43654,
43790
+ "": 43655,
43791
+ "": 43656,
43792
+ "": 43657,
43793
+ "": 43658,
43794
+ "": 43659,
43795
+ "": 43660,
43796
+ "": 43661,
43797
+ "": 43662,
43798
+ "": 43663,
43799
+ "": 43664,
43800
+ "": 43665,
43801
+ "": 43666,
43802
+ "": 43667,
43803
+ "": 43668,
43804
+ "": 43669,
43805
+ "": 43670,
43806
+ "": 43671,
43807
+ "": 43672,
43808
+ "": 43673,
43809
+ "": 43674,
43810
+ "": 43675,
43811
+ "": 43676,
43812
+ "": 43677,
43813
+ "": 43678,
43814
+ "": 43679,
43815
+ "": 43680,
43816
+ "": 43681,
43817
+ "": 43682,
43818
+ "": 43683,
43819
+ "": 43684,
43820
+ "": 43685,
43821
+ "": 43686,
43822
+ "": 43687,
43823
+ "": 43688,
43824
+ "": 43689,
43825
+ "": 43690,
43826
+ "": 43691,
43827
+ "": 43692,
43828
+ "": 43693,
43829
+ "": 43694,
43830
+ "": 43695,
43831
+ "": 43696,
43832
+ "": 43697,
43833
+ "": 43698,
43834
+ "": 43699,
43835
+ "": 43700,
43836
+ "": 43701,
43837
+ "": 43702,
43838
+ "": 43703,
43839
+ "": 43704,
43840
+ "": 43705,
43841
+ "": 43706,
43842
+ "": 43707,
43843
+ "": 43708,
43844
+ "": 43709,
43845
+ "": 43710,
43846
+ "": 43711,
43847
+ "": 43712,
43848
+ "": 43713,
43849
+ "": 43714,
43850
+ "": 43715,
43851
+ "": 43716,
43852
+ "": 43717,
43853
+ "": 43718,
43854
+ "": 43719,
43855
+ "": 43720,
43856
+ "": 43721,
43857
+ "": 43722,
43858
+ "": 43723,
43859
+ "": 43724,
43860
+ "": 43725,
43861
+ "": 43726,
43862
+ "": 43727,
43863
+ "": 43728,
43864
+ "": 43729,
43865
+ "": 43730,
43866
+ "": 43731,
43867
+ "": 43732,
43868
+ "": 43733,
43869
+ "": 43734,
43870
+ "": 43735,
43871
+ "": 43736,
43872
+ "": 43737,
43873
+ "": 43738,
43874
+ "": 43739,
43875
+ "": 43740,
43876
+ "": 43741,
43877
+ "": 43742,
43878
+ "": 43743
43879
  },
43880
  "merges": [
43881
  "▁ t",
 
115380
  "▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁▁"
115381
  ]
115382
  }
115383
+ }
tokenizer_config.json CHANGED
@@ -1,6 +1,7 @@
1
  {
2
  "add_bos_token": true,
3
  "add_eos_token": false,
 
4
  "added_tokens_decoder": {
5
  "0": {
6
  "content": "<unk>",
@@ -31,6 +32,7 @@
31
  "clean_up_tokenization_spaces": false,
32
  "cls_token": "<s>",
33
  "eos_token": "</s>",
 
34
  "mask_token": "<unk>",
35
  "model_max_length": 4096,
36
  "pad_token": "</s>",
 
1
  {
2
  "add_bos_token": true,
3
  "add_eos_token": false,
4
+ "add_prefix_space": null,
5
  "added_tokens_decoder": {
6
  "0": {
7
  "content": "<unk>",
 
32
  "clean_up_tokenization_spaces": false,
33
  "cls_token": "<s>",
34
  "eos_token": "</s>",
35
+ "legacy": true,
36
  "mask_token": "<unk>",
37
  "model_max_length": 4096,
38
  "pad_token": "</s>",
upos.py CHANGED
@@ -1,5 +1,4 @@
1
- from transformers import TokenClassificationPipeline,LlamaModel,LlamaPreTrainedModel
2
- from transformers.modeling_outputs import TokenClassifierOutput
3
 
4
  class BellmanFordTokenClassificationPipeline(TokenClassificationPipeline):
5
  def __init__(self,**kwargs):
@@ -40,41 +39,3 @@ class BellmanFordTokenClassificationPipeline(TokenClassificationPipeline):
40
  t["text"]=model_outputs["sentence"][t["start"]:t["end"]]
41
  return w
42
 
43
- class RawTokenClassificationPipeline(TokenClassificationPipeline):
44
- def check_model_type(self,supported_models):
45
- pass
46
-
47
- class LlamaForTokenClassification(LlamaPreTrainedModel):
48
- def __init__(self,config):
49
- from torch import nn
50
- super().__init__(config)
51
- self.num_labels=config.num_labels
52
- self.model=LlamaModel(config)
53
- if hasattr(config,"classifier_dropout") and config.classifier_dropout is not None:
54
- classifier_dropout=config.classifier_dropout
55
- elif hasattr(config,"hidden_dropout") and config.hidden_dropout is not None:
56
- classifier_dropout=config.hidden_dropout
57
- else:
58
- classifier_dropout=0.1
59
- self.dropout=nn.Dropout(classifier_dropout)
60
- self.classifier=nn.Linear(config.hidden_size,config.num_labels)
61
- self.post_init()
62
- def get_input_embeddings(self):
63
- return self.model.embed_tokens
64
- def set_input_embeddings(self,value):
65
- self.model.embed_tokens=value
66
- def forward(self,input_ids=None,past_key_values=None,attention_mask=None,position_ids=None,inputs_embeds=None,labels=None,use_cache=None,output_attentions=None,output_hidden_states=None,return_dict=None):
67
- return_dict=return_dict if return_dict is not None else self.config.use_return_dict
68
- transformer_outputs=self.model(input_ids,past_key_values=past_key_values,attention_mask=attention_mask,position_ids=position_ids,inputs_embeds=inputs_embeds,use_cache=use_cache,output_attentions=output_attentions,output_hidden_states=output_hidden_states,return_dict=return_dict)
69
- hidden_states=transformer_outputs[0]
70
- hidden_states=self.dropout(hidden_states)
71
- logits=self.classifier(hidden_states)
72
- loss=None
73
- if labels is not None:
74
- from torch import nn
75
- loss_fct=nn.CrossEntropyLoss()
76
- loss=loss_fct(logits.view(-1,self.num_labels),labels.view(-1))
77
- if not return_dict:
78
- output=(logits,)+transformer_outputs[2:]
79
- return ((loss,)+output) if loss is not None else output
80
- return TokenClassifierOutput(loss=loss,logits=logits,hidden_states=transformer_outputs.hidden_states,attentions=transformer_outputs.attentions)
 
1
+ from transformers import TokenClassificationPipeline
 
2
 
3
  class BellmanFordTokenClassificationPipeline(TokenClassificationPipeline):
4
  def __init__(self,**kwargs):
 
39
  t["text"]=model_outputs["sentence"][t["start"]:t["end"]]
40
  return w
41