{"id":20779432,"url":"https://github.com/freedomintelligence/cail2022","last_synced_at":"2025-06-25T20:07:19.569Z","repository":{"id":255355347,"uuid":"727636626","full_name":"FreedomIntelligence/CAIL2022","owner":"FreedomIntelligence","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-09T06:57:27.000Z","size":184,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-11T22:19:40.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FreedomIntelligence.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-05T09:12:35.000Z","updated_at":"2024-11-28T19:09:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"7bc1c054-5341-4524-88c1-a637465cb8e3","html_url":"https://github.com/FreedomIntelligence/CAIL2022","commit_stats":null,"previous_names":["freedomintelligence/cail2022"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FreedomIntelligence/CAIL2022","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomIntelligence%2FCAIL2022","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomIntelligence%2FCAIL2022/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomIntelligence%2FCAIL2022/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomIntelligence%2FCAIL2022/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FreedomIntelligence","download_url":"https://codeload.github.com/FreedomIntelligence/CAIL2022/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreedomIntelligence%2FCAIL2022/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261945376,"owners_count":23234237,"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":[],"created_at":"2024-11-17T13:27:54.805Z","updated_at":"2025-06-25T20:07:19.506Z","avatar_url":"https://github.com/FreedomIntelligence.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CAIL2022\n\n## ⚡ Introduction\nThis is the code for the paper\n## ⚒️ Training\n### Install the dependencies\n```\n pip install -r requirements.txt\n```\n\n### Download the pretrained models\nDownload the pretrained XLNET and T5 models into `train-stage1` and `train-stage2`\n\n**XLNET:**(https://huggingface.co/hfl/chinese-xlnet-mid)\n\n**T5:**(https://huggingface.co/imxly/t5-pegasus)\n\n### First Stage\nYou can train the first-stage model by:\n\n```\n cd train-stage1\n bash run.sh\n```\nAfter training, you can prepare the data for the second stage:\n\n1️⃣  Since we want to extract the domian-related sentences, we observe the result in the first-stage trainig with the highest F1 value for the important label (1) in the test data of each fold as the best model to be filled into `prepare_for_generate.py \u003e best_model_index_list`.\n\n2️⃣ Run the command to genearate `train.jsonl`:\n\n```\nCUDA_VISIBLE_DEVICES=0 nohup python3 prepare_for_generate.py \u003e generate_data.out \u0026\n```\n\n3️⃣ Select the high-quality sentences based your own threshold:\n\n```\npython3 select_text.py\n```\n\n### Second Stage\n\n1️⃣ Put the data selected in the first stage (e.g. `train_stage2_0.5.jsonl`) and evaluation data in the folder `train-stage2/data_dir/`\n\n2️⃣ Train the generative model:\n\n```\ncd ../train-stage2\nbash run.sh\n```\n3️⃣ Select the best model on evaluation set (choose the model that performs the best during training if there is no evaluation set):\n\n```\nCUDA_VISIBLE_DEVICES=0 PYTHONIOENCODING=UTF-8 nohup python3 main.py \u003e main.out \u0026\npython3 evaluate.py \u003e evaluate.out\n```\n\n### Evaluation\n1️⃣ Put the extractive models in `e2e/extractor_model/` folder, abstractive model in `e2e/generator_model` folder and test data in the folder `e2e/data_dir/` and change the path of your downloaded XLNET and T5 models.\n\n2️⃣ Fill the same `best_model_index_list` in `extractor.py` and their corresponsing index as **Training First Stage**\n\n3️⃣Generate the two-stage summary:\n\n```\ncd ../e2e\nbash run.sh\n```\n\n## 🏆 Awards\nOur team won the first prize in 2022 CAIL Summary of Legal Public Opinion.\n\n![pic](img/award.jpg)\n## 📕 Citation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreedomintelligence%2Fcail2022","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreedomintelligence%2Fcail2022","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreedomintelligence%2Fcail2022/lists"}