{"id":17115534,"url":"https://github.com/codewithzichao/deepclassifier","last_synced_at":"2025-10-28T05:34:47.148Z","repository":{"id":62567385,"uuid":"322551103","full_name":"codewithzichao/DeepClassifier","owner":"codewithzichao","description":"DeepClassifier is aimed at building general text classification model library.It's easy and user-friendly to build any text classification task.","archived":false,"fork":false,"pushed_at":"2021-02-15T04:23:42.000Z","size":6014,"stargazers_count":31,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T20:51:33.385Z","etag":null,"topics":["deep-learning","deepclassifier","nlp","pytorch","text-classification","torch"],"latest_commit_sha":null,"homepage":"https://deepclassifier.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codewithzichao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-18T09:38:29.000Z","updated_at":"2024-01-25T09:03:06.000Z","dependencies_parsed_at":"2022-11-03T16:30:32.582Z","dependency_job_id":null,"html_url":"https://github.com/codewithzichao/DeepClassifier","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithzichao%2FDeepClassifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithzichao%2FDeepClassifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithzichao%2FDeepClassifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithzichao%2FDeepClassifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewithzichao","download_url":"https://codeload.github.com/codewithzichao/DeepClassifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657820,"owners_count":21140842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","deepclassifier","nlp","pytorch","text-classification","torch"],"created_at":"2024-10-14T17:45:04.099Z","updated_at":"2025-10-28T05:34:42.104Z","avatar_url":"https://github.com/codewithzichao.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **DeepClassifier** \nDeepClassifier is a python package based on pytorch, which is easy-use and general for text classification task. You can install DeepClassifier by `pip install -U deepclassifier`。\nIf you want to know more information about DeepClassifier, please see the [**documentation**](https://deepclassifier.readthedocs.io/en/latest/). So let's start!🤩\n\u003e If you think DeepClassifier is good, please star and fork it to give me motivation to continue maintenance！🤩 And it's my pleasure that if Deepclassifier is helpful to you!🥰\n\n## **Installation**\nJust like other Python packages, DeepClassifier also can be installed through pip.The command of installation is `pip install -U deepclassifier`.\n\n## **Models**\nHere is a list of models that have been integrated into DeepClassifier. In the future, we will integrate more models into DeepClassifier. Welcome to join us!🤩\n1. **TextCNN:** [Convolutional Neural Networks for Sentence Classiﬁcation](https://www.aclweb.org/anthology/D14-1181.pdf) ,2014 EMNLP\n2. **RCNN:** [Recurrent Convolutional Neural Networks for Text Classification](https://www.deeplearningitalia.com/wp-content/uploads/2018/03/Recurrent-Convolutional-Neural-Networks-for-Text-Classification.pdf),2015,IJCAI\n3. **DPCNN:** [Deep Pyramid Convolutional Neural Networks for Text Categorization](https://ai.tencent.com/ailab/media/publications/ACL3-Brady.pdf) ,2017,ACL\n4. **HAN:** [Hierarchical Attention Networks for Document Classiﬁcation](https://www.aclweb.org/anthology/N16-1174.pdf), 2016,ACL\n5. **BERT:** [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/pdf/1810.04805.pdf),2018, ACL\n6. **BertTextCNN:** BERT+TextCNN\n7. **BertRCNN:** BERT+RCNN\n8. **BertDPCNN:** BERT+DPCNN\n9. **BertHAN:** BERT+HAN\n...\n  \n## Quick start\nI wiil show you that how to use DeepClassifier below.🥰 Click [**[here]**](https://github.com/codewithzichao/DeepClassifier/blob/master/examples) to display the complete code.\n\nyou can define model like that(take BertTextCNN model as example):👇\n\n```python\nfrom deepclassifier.models import BertTextCNN\n\n# parameters of model\nembedding_dim = 768  # if you use bert, the default is 768.\ndropout_rate = 0.2\nnum_class = 2\nbert_path = \"/Users/codewithzichao/Desktop/bert-base-uncased/\"\n\nmy_model = BertTextCNN(embedding_dim=embedding_dim,\n                       dropout_rate=dropout_rate,\n                       num_class=num_class,\n                       bert_path=bert_path)\n\noptimizer = optim.Adam(my_model.parameters())\nloss_fn = nn.CrossEntropyLoss()\n```\nAfter defining model, you can train/test/predict model like that:👇\n\n```python\nfrom deepclassifier.trainers import Trainer\n\nmodel_name = \"berttextcnn\"\nsave_path = \"best.ckpt\"\nwriter = SummaryWriter(\"logfie/1\")\nmax_norm = 0.25\neval_step_interval = 20\n\nmy_trainer =Trainer(model_name=model_name,model=my_model,\n                    train_loader=train_loader,dev_loader=dev_loader,\n                    test_loader=test_loader, optimizer=optimizer, \n                    loss_fn=loss_fn,save_path=save_path, epochs=1, \n                    writer=writer, max_norm=max_norm,\n                    eval_step_interval=eval_step_interval)\n\n# training\nmy_trainer.train()\n# print the best F1 value on dev set\nprint(my_trainer.best_f1)\n\n# testing\np, r, f1 = my_trainer.test()\nprint(p, r, f1)\n\n# predict\npred_data = DataLoader(pred_data, batch_size=1)\npred_label = my_trainer.predict(pred_data)\nprint(pred_label)\n\n```\n\n## **Contact me**\nIf you want any questions about DeepClassifier, welcome to submit issue or pull requests! And welcome to communicate with me through 2843656167@qq.com.🥳\n\n## Citation\n```tex\n@misc{zichao2020deepclassifier,\nauthor = {Zichao Li},\ntitle = {DeepClassifier: use-friendly and flexiable package of NLP based text classification models},\nyear = {2020},\npublisher = {GitHub},\njournal = {GitHub Repository},\nhowpublished = {\\url{https://github.com/codewithzichao/DeepClassifier}},\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithzichao%2Fdeepclassifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithzichao%2Fdeepclassifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithzichao%2Fdeepclassifier/lists"}