PaoDing


NamePaoDing JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryAn NLP-oriented PyTorch wrapper that makes your life easier.
upload_time2022-12-02 19:59:55
maintainer
docs_urlNone
authorZhaofeng Wu
requires_python>=3.9.0
licenseApache 2.0
keywords pytorch deep learning machine nlp ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PaoDing

An opiniated NLP-oriented PyTorch wrapper that makes your life easier. It is in spirit similar to AllenNLP. The goal of this library is to hide all boilerplate code. I created it so that I don't have to dig through the codebase to understand how something works in other libraries or create a PR every time I find something inconvenient to use. Also, perhaps in contrast to other libraries, the hiding of boilerplate is aggressive -- when something could either be hidden or not hidden, it usually errs on the side of hiding it.

NB: if you want to use this library for development, it might be easier to `pip install -e .` from source, so that you can put breakpoints anywhere.

## Examples

The below examples trains and evaluate on MNLI. In our environment, it achieves 86.5%/86.6% accuracy on MNLI matched/mismatched dev sets.

```bash
python examples/train_sequence_classification.py --data_dir data_cache --model_name_or_path bert-large-cased --batch_size 32 --max_length 256 --lr 0.00001 --warmup_ratio 0.06 --epochs 3 --clip_norm 1.0 --output_dir mnli
python examples/evaluate.py --ckpt_path mnli/best.ckpt
```

## Etymology

Pao Ding (庖丁) is a character in the classic ancient Chinese text [Zhuangzi](https://en.wikipedia.org/wiki/Zhuangzi_(book)), published around the 3rd century BC. Pao (庖) means cook, his occupation, and Ding (丁) is his name.

> 庖丁为文惠君解牛,手之所触,肩之所倚,足之所履,膝之所踦,砉然向然,奏刀𬴃然,莫不中音;合于《桑林》之舞,乃中《经首》之会。
>
> 文惠君曰:「嘻,善哉!技盖至此乎?」
>
> 庖丁释刀对曰:「臣之所好者道也,进乎技矣。始臣之解牛之时,所见无非全牛者。三年之后,未尝见全牛也。方今之时,臣以神遇而不以目视,官知止而神欲行。依乎天理,批大郤导大窾因其固然。枝经肯綮之未尝微滞,而况大軱乎!良庖岁更刀,割也;族庖月更刀,折也。今臣之刀十九年矣,所解数千牛矣,而刀刃若新发于硎。彼节者有间,而刀刃者无厚;以无厚入有间,恢恢乎其于游刃必有余地矣。是以十九年而刀刃若新发于硎。虽然,每至于族,吾见其难为,怵然为戒,视为止,行为迟。动刀甚微,謋然已解,牛不知其死也,如土委地。提刀而立,为之四顾,为之踌躇滿志,善刀而藏之。」
>
> 文惠君曰:「善哉!吾闻庖丁之言,得养生焉。」

陈鼓应. 庄子今注今译[M]. 北京:中华书局,2016:106-107.

> Cook [D]ing was cutting up an ox for Lord Wen-hui. At every touch of his hand, every heave of his shoulder, every move of his feet, every thrust of his knee - zip! zoop! He slithered the knife along with a zing, and all was in perfect rhythm, as though he were performing the dance of the Mulberry Grove or keeping time to the Ching-shou music.
>
> "Ah, this is marvelous!" said Lord Wen-hui. "Imagine skill reaching such heights!"
>
> Cook [D]ing laid down his knife and replied, "What I care about is the Way, which goes beyond skill. When I first began cutting up oxen, all I could see was the ox itself. After three years I no longer saw the whole ox. And now - now I go at it by spirit and don't look with my eyes. Perception and understanding have come to a stop and spirit moves where it wants. I go along with the natural makeup, strike in the big hollows, guide the knife through the big openings, and follow things as they are. So I never touch the smallest ligament or tendon, much less a main joint.
>
> "A good cook changes his knife once a year-because he cuts. A mediocre cook changes his knife once a month-because he hacks. I've had this knife of mine for nineteen years and I've cut up thousands of oxen with it, and yet the blade is as good as though it had just come from the grindstone. There are spaces between the joints, and the blade of the knife has really no thickness. If you insert what has no thickness into such spaces, then there's plenty of room - more than enough for the blade to play about it. That's why after nineteen years the blade of my knife is still as good as when it first came from the grindstone.
>
> "However, whenever I come to a complicated place, I size up the difficulties, tell myself to watch out and be careful, keep my eyes on what I'm doing, work very slowly, and move the knife with the greatest subtlety, until - flop! the whole thing comes apart like a clod of earth crumbling to the ground. I stand there holding the knife and look all around me, completely satisfied and reluctant to move on, and then I wipe off the knife and put it away."
>
> "Excellent!" said Lord Wen-hui. "I have heard the words of Cook [D]ing and learned how to care for life!"

Watson, Burton, trans. 1964. Chuang Tzu, basic writings. New York: Columbia University Press.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "PaoDing",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9.0",
    "maintainer_email": "",
    "keywords": "pytorch deep learning machine NLP AI",
    "author": "Zhaofeng Wu",
    "author_email": "zfw7@cs.washington.edu",
    "download_url": "https://files.pythonhosted.org/packages/61/f7/3fe946d9342b740c75a11999d2415706bcff2554fdada0c48d8f70e22aef/PaoDing-0.1.1.tar.gz",
    "platform": null,
    "description": "# PaoDing\n\nAn opiniated NLP-oriented PyTorch wrapper that makes your life easier. It is in spirit similar to AllenNLP. The goal of this library is to hide all boilerplate code. I created it so that I don't have to dig through the codebase to understand how something works in other libraries or create a PR every time I find something inconvenient to use. Also, perhaps in contrast to other libraries, the hiding of boilerplate is aggressive -- when something could either be hidden or not hidden, it usually errs on the side of hiding it.\n\nNB: if you want to use this library for development, it might be easier to `pip install -e .` from source, so that you can put breakpoints anywhere.\n\n## Examples\n\nThe below examples trains and evaluate on MNLI. In our environment, it achieves 86.5%/86.6% accuracy on MNLI matched/mismatched dev sets.\n\n```bash\npython examples/train_sequence_classification.py --data_dir data_cache --model_name_or_path bert-large-cased --batch_size 32 --max_length 256 --lr 0.00001 --warmup_ratio 0.06 --epochs 3 --clip_norm 1.0 --output_dir mnli\npython examples/evaluate.py --ckpt_path mnli/best.ckpt\n```\n\n## Etymology\n\nPao Ding (\u5e96\u4e01) is a character in the classic ancient Chinese text [Zhuangzi](https://en.wikipedia.org/wiki/Zhuangzi_(book)), published around the 3rd century BC. Pao (\u5e96) means cook, his occupation, and Ding (\u4e01) is his name.\n\n> \u5e96\u4e01\u4e3a\u6587\u60e0\u541b\u89e3\u725b\uff0c\u624b\u4e4b\u6240\u89e6\uff0c\u80a9\u4e4b\u6240\u501a\uff0c\u8db3\u4e4b\u6240\u5c65\uff0c\u819d\u4e4b\u6240\u8e26\uff0c\u7809\u7136\u5411\u7136\uff0c\u594f\u5200\ud873\udd03\u7136\uff0c\u83ab\u4e0d\u4e2d\u97f3\uff1b\u5408\u4e8e\u300a\u6851\u6797\u300b\u4e4b\u821e\uff0c\u4e43\u4e2d\u300a\u7ecf\u9996\u300b\u4e4b\u4f1a\u3002\n>\n> \u6587\u60e0\u541b\u66f0\uff1a\u300c\u563b\uff0c\u5584\u54c9\uff01\u6280\u76d6\u81f3\u6b64\u4e4e\uff1f\u300d\n>\n> \u5e96\u4e01\u91ca\u5200\u5bf9\u66f0\uff1a\u300c\u81e3\u4e4b\u6240\u597d\u8005\u9053\u4e5f\uff0c\u8fdb\u4e4e\u6280\u77e3\u3002\u59cb\u81e3\u4e4b\u89e3\u725b\u4e4b\u65f6\uff0c\u6240\u89c1\u65e0\u975e\u5168\u725b\u8005\u3002\u4e09\u5e74\u4e4b\u540e\uff0c\u672a\u5c1d\u89c1\u5168\u725b\u4e5f\u3002\u65b9\u4eca\u4e4b\u65f6\uff0c\u81e3\u4ee5\u795e\u9047\u800c\u4e0d\u4ee5\u76ee\u89c6\uff0c\u5b98\u77e5\u6b62\u800c\u795e\u6b32\u884c\u3002\u4f9d\u4e4e\u5929\u7406\uff0c\u6279\u5927\u90e4\u5bfc\u5927\u7abe\u56e0\u5176\u56fa\u7136\u3002\u679d\u7ecf\u80af\u7dae\u4e4b\u672a\u5c1d\u5fae\u6ede\uff0c\u800c\u51b5\u5927\u8ef1\u4e4e\uff01\u826f\u5e96\u5c81\u66f4\u5200\uff0c\u5272\u4e5f\uff1b\u65cf\u5e96\u6708\u66f4\u5200\uff0c\u6298\u4e5f\u3002\u4eca\u81e3\u4e4b\u5200\u5341\u4e5d\u5e74\u77e3\uff0c\u6240\u89e3\u6570\u5343\u725b\u77e3\uff0c\u800c\u5200\u5203\u82e5\u65b0\u53d1\u4e8e\u784e\u3002\u5f7c\u8282\u8005\u6709\u95f4\uff0c\u800c\u5200\u5203\u8005\u65e0\u539a\uff1b\u4ee5\u65e0\u539a\u5165\u6709\u95f4\uff0c\u6062\u6062\u4e4e\u5176\u4e8e\u6e38\u5203\u5fc5\u6709\u4f59\u5730\u77e3\u3002\u662f\u4ee5\u5341\u4e5d\u5e74\u800c\u5200\u5203\u82e5\u65b0\u53d1\u4e8e\u784e\u3002\u867d\u7136\uff0c\u6bcf\u81f3\u4e8e\u65cf\uff0c\u543e\u89c1\u5176\u96be\u4e3a\uff0c\u6035\u7136\u4e3a\u6212\uff0c\u89c6\u4e3a\u6b62\uff0c\u884c\u4e3a\u8fdf\u3002\u52a8\u5200\u751a\u5fae\uff0c\u8b0b\u7136\u5df2\u89e3\uff0c\u725b\u4e0d\u77e5\u5176\u6b7b\u4e5f\uff0c\u5982\u571f\u59d4\u5730\u3002\u63d0\u5200\u800c\u7acb\uff0c\u4e3a\u4e4b\u56db\u987e\uff0c\u4e3a\u4e4b\u8e0c\u8e87\u6eff\u5fd7\uff0c\u5584\u5200\u800c\u85cf\u4e4b\u3002\u300d\n>\n> \u6587\u60e0\u541b\u66f0\uff1a\u300c\u5584\u54c9\uff01\u543e\u95fb\u5e96\u4e01\u4e4b\u8a00\uff0c\u5f97\u517b\u751f\u7109\u3002\u300d\n\n\u9648\u9f13\u5e94. \u5e84\u5b50\u4eca\u6ce8\u4eca\u8bd1[M]. \u5317\u4eac\uff1a\u4e2d\u534e\u4e66\u5c40\uff0c2016:106-107.\n\n> Cook [D]ing was cutting up an ox for Lord Wen-hui. At every touch of his hand, every heave of his shoulder, every move of his feet, every thrust of his knee - zip! zoop! He slithered the knife along with a zing, and all was in perfect rhythm, as though he were performing the dance of the Mulberry Grove or keeping time to the Ching-shou music.\n>\n> \"Ah, this is marvelous!\" said Lord Wen-hui. \"Imagine skill reaching such heights!\"\n>\n> Cook [D]ing laid down his knife and replied, \"What I care about is the Way, which goes beyond skill. When I first began cutting up oxen, all I could see was the ox itself. After three years I no longer saw the whole ox. And now - now I go at it by spirit and don't look with my eyes. Perception and understanding have come to a stop and spirit moves where it wants. I go along with the natural makeup, strike in the big hollows, guide the knife through the big openings, and follow things as they are. So I never touch the smallest ligament or tendon, much less a main joint.\n>\n> \"A good cook changes his knife once a year-because he cuts. A mediocre cook changes his knife once a month-because he hacks. I've had this knife of mine for nineteen years and I've cut up thousands of oxen with it, and yet the blade is as good as though it had just come from the grindstone. There are spaces between the joints, and the blade of the knife has really no thickness. If you insert what has no thickness into such spaces, then there's plenty of room - more than enough for the blade to play about it. That's why after nineteen years the blade of my knife is still as good as when it first came from the grindstone.\n>\n> \"However, whenever I come to a complicated place, I size up the difficulties, tell myself to watch out and be careful, keep my eyes on what I'm doing, work very slowly, and move the knife with the greatest subtlety, until - flop! the whole thing comes apart like a clod of earth crumbling to the ground. I stand there holding the knife and look all around me, completely satisfied and reluctant to move on, and then I wipe off the knife and put it away.\"\n>\n> \"Excellent!\" said Lord Wen-hui. \"I have heard the words of Cook [D]ing and learned how to care for life!\"\n\nWatson, Burton, trans. 1964. Chuang Tzu, basic writings. New York: Columbia University Press.\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "An NLP-oriented PyTorch wrapper that makes your life easier.",
    "version": "0.1.1",
    "split_keywords": [
        "pytorch",
        "deep",
        "learning",
        "machine",
        "nlp",
        "ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "3c0bfd834a194bb209b7f2dbe2303168",
                "sha256": "e1e19f6fb205c001aea35e646afaa9cef82ad2e39f050b29667126b3b9048571"
            },
            "downloads": -1,
            "filename": "PaoDing-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3c0bfd834a194bb209b7f2dbe2303168",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9.0",
            "size": 16836,
            "upload_time": "2022-12-02T19:59:53",
            "upload_time_iso_8601": "2022-12-02T19:59:53.658883Z",
            "url": "https://files.pythonhosted.org/packages/b6/3b/a187978c96b7207969fcb9c45cdd954458bf491c256c45e3619b3f73ce53/PaoDing-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "bc76ec7effc0a11336b2ca680efc1cc4",
                "sha256": "83bf7e3ac128596ff6bee4f94a0a14c554215aff9fb4f727d4414a5a3b3fd9b0"
            },
            "downloads": -1,
            "filename": "PaoDing-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "bc76ec7effc0a11336b2ca680efc1cc4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9.0",
            "size": 15088,
            "upload_time": "2022-12-02T19:59:55",
            "upload_time_iso_8601": "2022-12-02T19:59:55.714233Z",
            "url": "https://files.pythonhosted.org/packages/61/f7/3fe946d9342b740c75a11999d2415706bcff2554fdada0c48d8f70e22aef/PaoDing-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-02 19:59:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "paoding"
}
        
Elapsed time: 0.03946s