{"id":13754387,"url":"https://github.com/squareRoot3/Target-Guided-Conversation","last_synced_at":"2025-05-09T22:32:05.433Z","repository":{"id":122538282,"uuid":"178517428","full_name":"squareRoot3/Target-Guided-Conversation","owner":"squareRoot3","description":"\"Target-Guided Open-Domain Conversation\" in ACL 2019","archived":false,"fork":false,"pushed_at":"2019-06-06T14:53:55.000Z","size":75,"stargazers_count":149,"open_issues_count":2,"forks_count":23,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-16T07:33:30.703Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://aclanthology.org/P19-1565/","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/squareRoot3.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":"2019-03-30T05:48:51.000Z","updated_at":"2024-09-02T08:15:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"1af75b15-dd70-44f8-955e-fe00f677dd9c","html_url":"https://github.com/squareRoot3/Target-Guided-Conversation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squareRoot3%2FTarget-Guided-Conversation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squareRoot3%2FTarget-Guided-Conversation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squareRoot3%2FTarget-Guided-Conversation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squareRoot3%2FTarget-Guided-Conversation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/squareRoot3","download_url":"https://codeload.github.com/squareRoot3/Target-Guided-Conversation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253335871,"owners_count":21892750,"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-08-03T09:01:57.863Z","updated_at":"2025-05-09T22:32:00.395Z","avatar_url":"https://github.com/squareRoot3.png","language":"Python","funding_links":[],"categories":["其他_NLP自然语言处理","Python"],"sub_categories":["其他_文本生成、文本对话"],"readme":"# Target-Guided Open-Domain Conversation\r\n\r\nThis is the code for the following paper:\r\n\r\n[Target-Guided Open-Domain Conversation](http://arxiv.org/abs/1905.11553)  \r\n*Jianheng Tang, Tiancheng Zhao, Chenyan Xiong, Xiaodan Liang, Eric Xing, Zhiting Hu; ACL 2019*\r\n\r\n### Requirement\r\n\r\n- `nltk==3.4`  \r\n- `tensoflow==1.12`   \r\n- `texar\u003e=0.2.1` ([Texar](https://github.com/asyml/texar))\r\n\r\n### Usage\r\n\r\n#### Data Preparation\r\nThe dataset developed in the paper is on [google drive](https://drive.google.com/file/d/1oTjOQjm7iiUitOPLCmlkXOCbEPoSWDPX/view?usp=sharing). Download \r\nand unzip it into `preprocess/convai2`. Then run the following command:\r\n```shell\r\ncd preprocess\r\npython prepare_data.py\r\n```\r\nBy default, the processed data will be put in the `tx_data` directory.\r\n\r\n#### Turn-level Supervised Learning\r\nIn this project there are 5 different types of agents, including the kernel/neural/matrix/retrieval/retrieval_stgy agent,\r\n which are all discribed in the paper. You can modify the configration of each agent in the `config` directory.\r\n\r\nTo train the kernel/neural/matrix agent, you need to first train/test the keyword prediction module, \r\nand then train/test the retrieval module of each agent specified by the `--agent` parameter.\r\n\r\n```shell\r\npython train.py --mode train_kw --agent kernel\r\npython train.py --mode train --agent kernel\r\npython train.py --mode test --agent kernel\r\n```\r\n\r\nThe retrieval agent and the retrieval_stgy agent share the same retrival module. You only need to train one of them:\r\n\r\n```shell\r\npython train.py --mode train --agent retrieval\r\npython train.py --mode test --agent retrieval\r\n```\r\n\r\n#### Target-guided Conversation\r\n\r\nAfter turn-level training, you can start target-guided conversation (human evaluation) with \r\nthe kernel/neural/matrix/retrieval/retrieval_stgy  agent specified by the `--agent` parameter.\r\n\r\n```shell\r\npython chat.py --agent kernel\r\n```\r\nA demo of target-guided conversation (user is required to input the response after `HUMAN:`)\r\n\r\n```\r\n--------Session 0 --------\r\nSTART:  hello, how are you doing\r\nHUMAN:  hi i am great just finishing up some homework. how about you\r\nAGENT:  just got done eating some chicken and rice after i got done with my gym session\r\nHUMAN:  i am gonna eat some vegetable for dinner\r\nAGENT:  so you are vegetarian ? i am from los angeles so thereare lots of vegetarian restaurants\r\nHUMAN:  i am not a vegetarian . fried chicken is my favorite.\r\nAGENT:  oh boy , when i go to mcdonald i always get fries for my 2 dogs\r\nSuccessfully chat to the target 'mcdonald'.\r\n```\r\n\r\nYou can also watch the simulation of the target-guided conversation \r\nbetween the retrieval agent pretending the user and the kernel/neural/matrix/retrieval_stgy agent specified by the `--agent` parameter. Simulation times are defined by the `--times` parameter. The program will calculate the success times and average turns in the end.\r\n\r\n```shell\r\npython simulate.py --agent kernel --times 100\r\n```\r\n\r\nA demo of simulation:\r\n```\r\n--------Session 0 --------\r\nSTART: hey hey good morning to you\r\nretrieval_agent:  fine thanks . what do you do for a living ?\r\nkernel_agent:  rewarding job , i work at a hospital\r\nKeyword: job, Similarity: 0.58\r\nSuccessfully chat to the target 'hospital'.\r\n\r\n...\r\n--------Session 99 --------\r\nSTART: hey hows it going ? i'm just cooking a steak\r\nretrieval_agent:  i'm thinking of a bbq sandwich for lunch\r\nkernel_agent:  nice i love to cook but now its just me and the fur babies\r\nKeyword: baby, Similarity: 0.45\r\nretrieval_agent:  i love bagels however i own a dry cleaners\r\nkernel_agent:  i love animals felix my cat and my dog emmy\r\nKeyword: cat, Similarity: 0.56\r\nretrieval_agent:  sounds awesome i have all kind of pets my family own a farm\r\nkernel_agent:  i love blue as well even my hair is blue\r\nKeyword: blue, Similarity: 1.00\r\nSuccessfully chat to the target 'blue'.\r\n\r\nsuccess time 83, average turns 4.28\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FsquareRoot3%2FTarget-Guided-Conversation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FsquareRoot3%2FTarget-Guided-Conversation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FsquareRoot3%2FTarget-Guided-Conversation/lists"}