Upload folder using huggingface_hub
Browse filesFiles changed (11)
- punct/.gitattributesAdded+16
- punct/README.mdAdded+95
- punct/config.jsonAdded+58
- punct/model_args.jsonAdded+1
- punct/optimizer.ptAdded+3
- punct/pytorch_model.binAdded+3
- punct/scheduler.ptAdded+3
- punct/special_tokens_map.jsonAdded+1
- punct/tokenizer_config.jsonAdded+1
- punct/training_args.binAdded+3
- punct/vocab.txtAdded
12345678910111213141516*.bin.* filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tar.gz filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.arrow filter=lfs diff=lfs merge=lfs -text*.ftz filter=lfs diff=lfs merge=lfs -text*.joblib filter=lfs diff=lfs merge=lfs -text*.model filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text*.pb filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text*.pth filter=lfs diff=lfs merge=lfs -text1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495---language:- entags:- punctuationlicense: mitdatasets:- yelp_polaritymetrics:- f1---# ✨ bert-restore-punctuation[]()
This a bert-base-uncased model finetuned for punctuation restoration on [Yelp Reviews](https://www.tensorflow.org/datasets/catalog/yelp_polarity_reviews).
The model predicts the punctuation and upper-casing of plain, lower-cased text. An example use case can be ASR output. Or other cases when text has lost punctuation.
This model is intended for direct use as a punctuation restoration model for the general English language. Alternatively, you can use this for further fine-tuning on domain-specific texts for punctuation restoration tasks.
Model restores the following punctuations -- **[! ? . , - : ; ' ]**
The model also restores the upper-casing of words.
-----------------------------------------------## 🚋 Usage**Below is a quick way to get up and running with the model.**1. First, install the package.```bashpip install rpunct```2. Sample python code.```pythonfrom rpunct import RestorePuncts# The default language is 'english'rpunct = RestorePuncts()rpunct.punctuate("""in 2018 cornell researchers built a high-powered detector that in combination with an algorithm-driven process called ptychography set a world recordby tripling the resolution of a state-of-the-art electron microscope as successful as it was that approach had a weakness it only worked with ultrathin samples that werea few atoms thick anything thicker would cause the electrons to scatter in ways that could not be disentangled now a team again led by david muller the samuel b eckertprofessor of engineering has bested its own record by a factor of two with an electron microscope pixel array detector empad that incorporates even more sophisticated3d reconstruction algorithms the resolution is so fine-tuned the only blurring that remains is the thermal jiggling of the atoms themselves""")# Outputs the following:# In 2018, Cornell researchers built a high-powered detector that, in combination with an algorithm-driven process called Ptychography, set a world record by tripling the# resolution of a state-of-the-art electron microscope. As successful as it was, that approach had a weakness. It only worked with ultrathin samples that were a few atoms# thick. Anything thicker would cause the electrons to scatter in ways that could not be disentangled. Now, a team again led by David Muller, the Samuel B. # Eckert Professor of Engineering, has bested its own record by a factor of two with an Electron microscope pixel array detector empad that incorporates even more# sophisticated 3d reconstruction algorithms. The resolution is so fine-tuned the only blurring that remains is the thermal jiggling of the atoms themselves.```
**This model works on arbitrarily large text in English language and uses GPU if available.**
-----------------------------------------------## 📡 Training data
Here is the number of product reviews we used for finetuning the model:
| Language | Number of text samples|| -------- | ----------------- || English | 560,000 |
We found the best convergence around _**3 epochs**_, which is what presented here and available via a download.
-----------------------------------------------## 🎯 AccuracyThe fine-tuned model obtained the following accuracy on 45,990 held-out text samples:
| Accuracy | Overall F1 | Eval Support || -------- | ---------------------- | ------------------- || 91% | 90% | 45,990
Below is a breakdown of the performance of the model by each label:
| label | precision | recall | f1-score | support|| --------- | -------------|-------- | ----------|--------|| **!** | 0.45 | 0.17 | 0.24 | 424 | **!+Upper** | 0.43 | 0.34 | 0.38 | 98 | **'** | 0.60 | 0.27 | 0.37 | 11 | **,** | 0.59 | 0.51 | 0.55 | 1522 | **,+Upper** | 0.52 | 0.50 | 0.51 | 239 | **-** | 0.00 | 0.00 | 0.00 | 18 | **.** | 0.69 | 0.84 | 0.75 | 2488 | **.+Upper** | 0.65 | 0.52 | 0.57 | 274 | **:** | 0.52 | 0.31 | 0.39 | 39 | **:+Upper** | 0.36 | 0.62 | 0.45 | 16 | **;** | 0.00 | 0.00 | 0.00 | 17 | **?** | 0.54 | 0.48 | 0.51 | 46 | **?+Upper** | 0.40 | 0.50 | 0.44 | 4 | **none** | 0.96 | 0.96 | 0.96 |35352 | **Upper** | 0.84 | 0.82 | 0.83 | 5442
-----------------------------------------------## ☕ Contact Contact [Daulet Nurmanbetov](daulet.nurmanbetov@gmail.com) for questions, feedback and/or requests for similar models.
-----------------------------------------------12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758{ "_name_or_path": "bert-base-uncased", "architectures": [ "BertForTokenClassification" ], "attention_probs_dropout_prob": 0.1, "gradient_checkpointing": false, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 768, "id2label": { "0": "LABEL_0", "1": "LABEL_1", "2": "LABEL_2", "3": "LABEL_3", "4": "LABEL_4", "5": "LABEL_5", "6": "LABEL_6", "7": "LABEL_7", "8": "LABEL_8", "9": "LABEL_9", "10": "LABEL_10", "11": "LABEL_11", "12": "LABEL_12", "13": "LABEL_13", "14": "LABEL_14" }, "initializer_range": 0.02, "intermediate_size": 3072, "label2id": { "LABEL_0": 0, "LABEL_1": 1, "LABEL_10": 10, "LABEL_11": 11, "LABEL_12": 12, "LABEL_13": 13, "LABEL_14": 14, "LABEL_2": 2, "LABEL_3": 3, "LABEL_4": 4, "LABEL_5": 5, "LABEL_6": 6, "LABEL_7": 7, "LABEL_8": 8, "LABEL_9": 9 }, "layer_norm_eps": 1e-12, "max_position_embeddings": 512, "model_type": "bert", "num_attention_heads": 12, "num_hidden_layers": 12, "pad_token_id": 0, "position_embedding_type": "absolute", "transformers_version": "4.6.0", "type_vocab_size": 2, "use_cache": true, "vocab_size": 30522}1{"adafactor_beta1": null, "adafactor_clip_threshold": 1.0, "adafactor_decay_rate": -0.8, "adafactor_eps": [1e-30, 0.001], "adafactor_relative_step": true, "adafactor_scale_parameter": true, "adafactor_warmup_init": true, "adam_epsilon": 1e-08, "best_model_dir": "outputs/best_model", "cache_dir": "cache_dir/", "config": {}, "cosine_schedule_num_cycles": 0.5, "custom_layer_parameters": [], "custom_parameter_groups": [], "dataloader_num_workers": 0, "do_lower_case": false, "dynamic_quantize": false, "early_stopping_consider_epochs": false, "early_stopping_delta": 0, "early_stopping_metric": "eval_loss", "early_stopping_metric_minimize": true, "early_stopping_patience": 3, "encoding": null, "eval_batch_size": 8, "evaluate_during_training": false, "evaluate_during_training_silent": true, "evaluate_during_training_steps": 2000, "evaluate_during_training_verbose": false, "evaluate_each_epoch": true, "fp16": true, "gradient_accumulation_steps": 1, "learning_rate": 4e-05, "local_rank": -1, "logging_steps": 50, "manual_seed": null, "max_grad_norm": 1.0, "max_seq_length": 512, "model_name": "bert-base-uncased", "model_type": "bert", "multiprocessing_chunksize": -1, "n_gpu": 1, "no_cache": false, "no_save": false, "not_saved_args": [], "num_train_epochs": 3, "optimizer": "AdamW", "output_dir": "outputs/", "overwrite_output_dir": true, "polynomial_decay_schedule_lr_end": 1e-07, "polynomial_decay_schedule_power": 1.0, "process_count": 2, "quantized_model": false, "reprocess_input_data": true, "save_best_model": true, "save_eval_checkpoints": true, "save_model_every_epoch": true, "save_optimizer_and_scheduler": true, "save_steps": 2000, "scheduler": "linear_schedule_with_warmup", "silent": false, "skip_special_tokens": true, "tensorboard_dir": null, "thread_count": null, "tokenizer_name": null, "tokenizer_type": null, "train_batch_size": 8, "train_custom_parameters_only": false, "use_cached_eval_features": false, "use_early_stopping": false, "use_hf_datasets": false, "use_multiprocessing": true, "use_multiprocessing_for_evaluation": true, "wandb_kwargs": {}, "wandb_project": null, "warmup_ratio": 0.06, "warmup_steps": 1520, "weight_decay": 0.0, "model_class": "NERModel", "classification_report": false, "labels_list": ["OU", "OO", ".O", "!O", ",O", ".U", "!U", ",U", ":O", ";O", ":U", "'O", "-O", "?O", "?U"], "lazy_loading": true, "lazy_loading_start_line": 0, "onnx": false, "special_tokens_list": []}123version https://git-lfs.github.com/spec/v1oid sha256:baa29e1cb9109755c6f437118966fbdeb80728f7892b2fa3560d95bb39fdc333size 871350381123version https://git-lfs.github.com/spec/v1oid sha256:fb8efcdafa21bf982d03fd1aa86f95227353e7ea624ca08afe2cac7d726a8cb2size 435701303123version https://git-lfs.github.com/spec/v1oid sha256:2d97f7651f224325f0d4b9f605d2296d6e56a594684edf6f268483074481ebddsize 6231{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}1{"do_lower_case": false, "do_basic_tokenize": true, "never_split": null, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "model_max_length": 512, "special_tokens_map_file": null, "tokenizer_file": "/home/ubuntu/.cache/huggingface/transformers/534479488c54aeaf9c3406f647aa2ec13648c06771ffe269edabebd4c412da1d.7f2721073f19841be16f41b0a70b600ca6b880c8f3df6f3535cbc704371bdfa4", "name_or_path": "bert-base-uncased"}123version https://git-lfs.github.com/spec/v1oid sha256:adf90f507e762161db2c536304e314215145aaed6db3be60a9e93ba1e68c7073size 2991punct/.gitattributesAdded+16
punct/README.mdAdded+95
punct/config.jsonAdded+58
punct/model_args.jsonAdded+1
punct/optimizer.ptAdded+3
punct/pytorch_model.binAdded+3
punct/scheduler.ptAdded+3
punct/special_tokens_map.jsonAdded+1
punct/tokenizer_config.jsonAdded+1
punct/training_args.binAdded+3
punct/vocab.txtAdded