├── docs ├── _data │ ├── terms.yml │ ├── glossary.yml │ ├── definitions.yml │ ├── tags.yml │ ├── topnav.yml │ ├── alerts.yml │ └── sidebars │ │ └── home_sidebar.yml ├── .gitignore ├── _layouts │ ├── none.html │ ├── page_print.html │ ├── default_print.html │ ├── page.html │ └── default.html ├── images │ ├── favicon.ico │ ├── company_logo.png │ ├── doc_example.png │ ├── export_example.png │ ├── workflowarrow.png │ ├── company_logo_big.png │ └── colab.svg ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── css │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 │ ├── boxshadowproperties.css │ ├── modern-business.css │ ├── theme-green.css │ ├── theme-blue.css │ ├── printstyles.css │ └── syntax.css ├── _includes │ ├── inline_image.html │ ├── callout.html │ ├── note.html │ ├── tip.html │ ├── important.html │ ├── warning.html │ ├── archive.html │ ├── notebook_colab_link.html │ ├── image.html │ ├── search_google_custom.html │ ├── footer.html │ ├── google_analytics.html │ ├── toc.html │ ├── search_simple_jekyll.html │ ├── links.html │ ├── head_print.html │ ├── sidebar.html │ ├── topnav.html │ ├── initialize_shuffle.html │ └── head.html ├── Gemfile ├── tooltips.json ├── sitemap.xml ├── js │ ├── jquery.ba-throttle-debounce.min.js │ ├── customscripts.js │ ├── jquery.navgoco.min.js │ ├── toc.js │ └── jekyll-search.js ├── special_tokens.html ├── licenses │ ├── LICENSE │ └── LICENSE-BSD-NAVGOCO.txt ├── _config.yml ├── feed.xml ├── sidebar.json ├── 0_base_params.html ├── test_base.html ├── bert_utils.html ├── index.html ├── 1_problem_type_cls.html └── 4_problem_type_masklm.html ├── m3tl ├── mtl_model │ ├── __init__.py │ ├── base.py │ └── mmoe.py ├── embedding_layer │ └── __init__.py ├── loss_strategy │ ├── __init__.py │ └── base.py ├── problem_types │ ├── __init__.py │ ├── utils.py │ ├── vector_fit.py │ ├── regression.py │ ├── cls.py │ ├── multi_cls.py │ ├── pretrain.py │ ├── masklm.py │ ├── contrastive_learning.py │ ├── seq2seq_text.py │ └── premask_mlm.py ├── bert_preprocessing │ └── __init__.py ├── predefined_problems │ ├── __init__.py │ └── README.md ├── tutorial.py ├── __init__.py ├── special_tokens.py ├── modeling.py ├── params.py └── input_fn.py ├── source_nbs ├── .last_checked ├── .gitattributes ├── 02_special_tokens.ipynb ├── 12_0_problem_type_utils.ipynb └── index.ipynb ├── _config.yml ├── .coveragerc ├── requirements.txt ├── Makefile ├── settings.ini ├── .gitconfig ├── docker-compose.yml ├── setup.py ├── .gitignore ├── README.md ├── CONTRIBUTING.md ├── baseline.md └── tests └── test_nbs.py /docs/_data/terms.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _site/ 2 | -------------------------------------------------------------------------------- /docs/_data/glossary.yml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /m3tl/mtl_model/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source_nbs/.last_checked: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_data/definitions.yml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /m3tl/embedding_layer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /m3tl/loss_strategy/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /m3tl/problem_types/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /m3tl/bert_preprocessing/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_layouts/none.html: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | {{content}} -------------------------------------------------------------------------------- /docs/_data/tags.yml: -------------------------------------------------------------------------------- 1 | allowed-tags: 2 | - getting_started 3 | - navigation 4 | -------------------------------------------------------------------------------- /source_nbs/.gitattributes: -------------------------------------------------------------------------------- 1 | **/*.ipynb filter=clean-nbs 2 | **/*.ipynb diff=ipynb 3 | -------------------------------------------------------------------------------- /docs/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/images/favicon.ico -------------------------------------------------------------------------------- /docs/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /docs/images/company_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/images/company_logo.png -------------------------------------------------------------------------------- /docs/images/doc_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/images/doc_example.png -------------------------------------------------------------------------------- /docs/css/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/css/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /docs/images/export_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/images/export_example.png -------------------------------------------------------------------------------- /docs/images/workflowarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/images/workflowarrow.png -------------------------------------------------------------------------------- /docs/_includes/inline_image.html: -------------------------------------------------------------------------------- 1 | {{include.alt}} 2 | -------------------------------------------------------------------------------- /docs/images/company_logo_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/images/company_logo_big.png -------------------------------------------------------------------------------- /docs/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | omit = 3 | */predefined_problems/* 4 | 5 | [report] 6 | omit = 7 | */predefined_problems/* -------------------------------------------------------------------------------- /docs/css/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/css/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/css/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/css/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /m3tl/predefined_problems/__init__.py: -------------------------------------------------------------------------------- 1 | from .ner_data import * 2 | from .cws_data import * 3 | from .test_data import * 4 | -------------------------------------------------------------------------------- /docs/_includes/callout.html: -------------------------------------------------------------------------------- 1 |
{{include.content}}
2 | -------------------------------------------------------------------------------- /docs/css/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/css/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/css/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/css/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayYip/m3tl/HEAD/docs/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /m3tl/tutorial.py: -------------------------------------------------------------------------------- 1 | # AUTOGENERATED! DO NOT EDIT! File to edit: source_nbs/tutorial.ipynb (unless otherwise specified). 2 | 3 | __all__ = [] -------------------------------------------------------------------------------- /docs/_includes/note.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/_includes/tip.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_includes/important.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_includes/warning.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy 2 | joblib 3 | tqdm 4 | six 5 | pandas 6 | setuptools 7 | nltk 8 | scikit_learn 9 | transformers 10 | tensorflow-addons 11 | loguru 12 | fastcore -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem 'github-pages', group: :jekyll_plugins 4 | 5 | # Added at 2019-11-25 10:11:40 -0800 by jhoward: 6 | gem "nokogiri", "< 1.13.3" 7 | gem "jekyll", ">= 3.7" 8 | gem "kramdown", ">= 2.3.0" 9 | -------------------------------------------------------------------------------- /docs/_data/topnav.yml: -------------------------------------------------------------------------------- 1 | topnav: 2 | - title: Topnav 3 | items: 4 | - title: github 5 | external_url: https://github.com/JayYip/m3tl/tree/master/ 6 | 7 | #Topnav dropdowns 8 | topnav_dropdowns: 9 | - title: Topnav dropdowns 10 | folders: -------------------------------------------------------------------------------- /docs/_includes/archive.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | type: archive 4 | --- 5 | 6 |
7 |

{{ page.title }}

8 |
9 |
10 | 11 | {{ content }} 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/_includes/notebook_colab_link.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | Open In Colab 4 | 5 |
6 | -------------------------------------------------------------------------------- /docs/tooltips.json: -------------------------------------------------------------------------------- 1 | --- 2 | layout: null 3 | search: exclude 4 | --- 5 | 6 | { 7 | "entries": 8 | [ 9 | {% for page in site.tooltips %} 10 | { 11 | "doc_id": "{{ page.doc_id }}", 12 | "body": "{{ page.content | strip_newlines | replace: '\', '\\\\' | replace: '"', '\\"' }}" 13 | } {% unless forloop.last %},{% endunless %} 14 | {% endfor %} 15 | ] 16 | } 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/_includes/image.html: -------------------------------------------------------------------------------- 1 |
{% if {{include.url}} %}{% endif %}{{include.alt}}{% if {{include.url}} %}{% endif %}{% if {{include.caption}} %}
{{include.caption}}
{% endif %}
2 | -------------------------------------------------------------------------------- /docs/_layouts/page_print.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default_print 3 | comments: true 4 | --- 5 |
6 |

{{ page.title }}

7 |
8 | 9 |
10 | 11 | {% if page.summary %} 12 |
{{page.summary}}
13 | {% endif %} 14 | {{ content }} 15 |
16 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: test 2 | 3 | 4 | check_dirs := tests 5 | 6 | test: 7 | pytest --cov-report xml:cov.xml --cov=m3tl 8 | 9 | nbbuild: 10 | nbdev_build_lib 11 | nbdev_build_docs 12 | 13 | commit: 14 | nbdev_read_nbs 15 | nbdev_clean_nbs 16 | nbdev_diff_nbs 17 | nbdev_test_nbs 18 | 19 | check: 20 | nbdev_read_nbs 21 | nbdev_clean_nbs 22 | nbdev_diff_nbs 23 | 24 | release: 25 | rm -rf dist/ 26 | python setup.py sdist bdist_wheel 27 | twine upload dist/* 28 | -------------------------------------------------------------------------------- /docs/_includes/search_google_custom.html: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 | 15 |
16 | 17 | -------------------------------------------------------------------------------- /docs/_includes/footer.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /settings.ini: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | host = github 3 | lib_name = m3tl 4 | user = JayYip 5 | branch = master 6 | version = 0.7.0 7 | min_python = 3.6 8 | audience = Developers 9 | language = English 10 | custom_sidebar = True 11 | license = apache2 12 | status = 4 13 | nbs_path = source_nbs 14 | doc_path = docs 15 | doc_host = https://JayYip.github.io 16 | doc_baseurl = /m3tl/ 17 | git_url = https://github.com/JayYip/m3tl/tree/master/ 18 | lib_path = m3tl 19 | title = m3tl 20 | tst_flags = slow 21 | copyright = jayyip 22 | description = BERT for Multi-task Learning 23 | 24 | -------------------------------------------------------------------------------- /.gitconfig: -------------------------------------------------------------------------------- 1 | # Generated by nbdev_install_git_hooks 2 | # 3 | # If you need to disable this instrumentation do: 4 | # 5 | # git config --local --unset include.path 6 | # 7 | # To restore the filter 8 | # 9 | # git config --local include.path .gitconfig 10 | # 11 | # If you see notebooks not stripped, checked the filters are applied in .gitattributes 12 | # 13 | [filter "clean-nbs"] 14 | clean = nbdev_clean_nbs --read_input_stream True 15 | smudge = cat 16 | required = true 17 | [diff "ipynb"] 18 | textconv = nbdev_clean_nbs --disp True --fname 19 | -------------------------------------------------------------------------------- /docs/_layouts/default_print.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {% include head_print.html %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 |
16 | 17 | {{content}} 18 |
19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/_includes/google_analytics.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% if site.google_analytics %} 4 | 5 | 6 | {% endif %} -------------------------------------------------------------------------------- /m3tl/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Author: Ye Junpeng 3 | # @Date: 2022-03-29 15:08:18 4 | # @Last Modified by: Ye Junpeng 5 | # @Last Modified time: 2022-06-06 14:34:31 6 | __version__ = "0.7.0" 7 | from .read_write_tfrecord import * 8 | from .input_fn import * 9 | from .model_fn import * 10 | from .base_params import * 11 | from .run_bert_multitask import * 12 | from .utils import * 13 | from .preproc_decorator import preprocessing_fn 14 | from . import predefined_problems 15 | from .special_tokens import * 16 | from .params import Params 17 | M3TL_PHASE = TRAIN 18 | -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | --- 2 | layout: none 3 | search: exclude 4 | --- 5 | 6 | 7 | 8 | {% for post in site.posts %} 9 | {% unless post.search == "exclude" %} 10 | 11 | {{site.url}}{{post.url}} 12 | 13 | {% endunless %} 14 | {% endfor %} 15 | 16 | 17 | {% for page in site.pages %} 18 | {% unless page.search == "exclude" %} 19 | 20 | {{site.url}}{{ page.url}} 21 | 22 | {% endunless %} 23 | {% endfor %} 24 | -------------------------------------------------------------------------------- /m3tl/predefined_problems/README.md: -------------------------------------------------------------------------------- 1 | # Predefined Problems 2 | 3 | ## weibo_ner/weibo_cws/weibo_fake_cls 4 | 5 | A small dataset that is good for debug and demo. 6 | 7 | ## cws 8 | 9 | Chinese word segmentation. Data source: 10 | 11 | ## NER 12 | 13 | Chinese Named Entity Recognition. Trained using following dataset: 14 | 15 | - [BosonNLP](https://bosonnlp.com/resources/BosonNLP_NER_6C.zip) 16 | - MSRA 17 | - Weibo 18 | 19 | ## ctb_cws/ctb_pos 20 | 21 | Chinese Treebank 8.0. Data source: 22 | -------------------------------------------------------------------------------- /docs/css/boxshadowproperties.css: -------------------------------------------------------------------------------- 1 | /* box-shadow fonts return errors with prince, so extracting here to put in web output only */ 2 | 3 | #search-demo-container ul#results-container { 4 | box-shadow: 2px 3px 2px #dedede; 5 | } 6 | 7 | 8 | hr.shaded { 9 | box-shadow: inset 0 6px 6px -6px rgba(0,0,0,0.5); 10 | } 11 | 12 | .videoThumbs img { 13 | box-shadow: 2px 2px 1px #f0f0f0; 14 | } 15 | 16 | .box { 17 | box-shadow: 2px 2px 4px #dedede; 18 | } 19 | 20 | @media (max-width: 1200px) { 21 | .navbar-collapse { 22 | box-shadow: inset 0 1px 0 rgba(255,255,255,0.1); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /m3tl/special_tokens.py: -------------------------------------------------------------------------------- 1 | # AUTOGENERATED! DO NOT EDIT! File to edit: source_nbs/02_special_tokens.ipynb (unless otherwise specified). 2 | 3 | __all__ = ['BOS_TOKEN', 'EOS_TOKEN', 'CLS_TOKEN', 'SPACE_TOKEN', 'UNK_TOKEN', 'SPECIAL_TOKENS', 'TRAIN', 'EVAL', 4 | 'PREDICT', 'MODAL_LIST'] 5 | 6 | # Cell 7 | BOS_TOKEN = '[unused98]' 8 | EOS_TOKEN = '[unused99]' 9 | CLS_TOKEN = '[CLS]' 10 | SPACE_TOKEN = '[unused1]' 11 | UNK_TOKEN = '[UNK]' 12 | SPECIAL_TOKENS = [BOS_TOKEN, EOS_TOKEN, CLS_TOKEN, SPACE_TOKEN, UNK_TOKEN] 13 | TRAIN = 'train' 14 | EVAL = 'eval' 15 | PREDICT = 'infer' 16 | MODAL_LIST = ['image', 'others'] -------------------------------------------------------------------------------- /docs/js/jquery.ba-throttle-debounce.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery throttle / debounce - v1.1 - 3/7/2010 3 | * http://benalman.com/projects/jquery-throttle-debounce-plugin/ 4 | * 5 | * Copyright (c) 2010 "Cowboy" Ben Alman 6 | * Dual licensed under the MIT and GPL licenses. 7 | * http://benalman.com/about/license/ 8 | */ 9 | (function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); -------------------------------------------------------------------------------- /docs/_includes/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 |
22 | -------------------------------------------------------------------------------- /docs/_includes/search_simple_jekyll.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
    4 |
    5 | 6 | 17 | -------------------------------------------------------------------------------- /docs/special_tokens.html: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | title: Special Tokens 4 | 5 | 6 | keywords: fastai 7 | sidebar: home_sidebar 8 | 9 | 10 | 11 | nb_path: "source_nbs/02_special_tokens.ipynb" 12 | --- 13 | 22 | 23 |
    24 | 25 | {% raw %} 26 | 27 |
    28 | 29 |
    30 | {% endraw %} 31 | 32 | {% raw %} 33 | 34 |
    35 | 36 |
    37 | {% endraw %} 38 | 39 |
    40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/_data/alerts.yml: -------------------------------------------------------------------------------- 1 | tip: '