Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3instruction = system_prompt_dict['instruction_e']
4paper = read_txt_file(mmd_file_path)
5idx = paper.find("## References")
6paper = paper[:idx].strip()
7
8model_name = "/root/sea/"
9tokenizer = AutoTokenizer.from_pretrained(model_name)
10chat_model = AutoModelForCausalLM.from_pretrained(model_name)
11chat_model.to("cuda:0")
12
13messages = [
14 {"role": "system", "content": instruction},
15 {"role": "user", "content": paper},
16]
17
18encodes = tokenizer.apply_chat_template(messages, return_tensors="pt")
19encodes = encodes.to("cuda:0")
20len_input = encodes.shape[1]
21generated_ids = chat_model.generate(encodes,max_new_tokens=8192,do_sample=True)
22# response = chat_model.chat(messages)[0].response_text
23response = tokenizer.batch_decode(generated_ids[: , len_input:])[0]
241@inproceedings{yu2024automated,
2 title={Automated Peer Reviewing in Paper SEA: Standardization, Evaluation, and Analysis},
3 author={Yu, Jianxiang and Ding, Zichen and Tan, Jiaqi and Luo, Kangyang and Weng, Zhenmin and Gong, Chenghua and Zeng, Long and Cui, RenJing and Han, Chengcheng and Sun, Qiushi and others},
4 booktitle={Findings of the Association for Computational Linguistics: EMNLP 2024},
5 pages={10164--10184},
6 year={2024}
7}