Views
No views yet


1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2
3tokenizer = AutoTokenizer.from_pretrained("zjunlp/chatcell-base")
4model = AutoModelForSeq2SeqLM.from_pretrained("zjunlp/chatcell-base")
5input_text="Detail the 100 starting genes for a Mix, ranked by expression level: "
6
7# Encode the input text and generate a response with specified generation parameters
8input_ids = tokenizer(input_text,return_tensors="pt").input_ids
9output_ids = model.generate(input_ids, max_length=512, num_return_sequences=1, no_repeat_ngram_size=2, top_k=50, top_p=0.95, do_sample=True)
10
11# Decode and print the generated output text
12output_text = tokenizer.decode(output_ids[0],skip_special_tokens=True)
13print(output_text)



@article{fang2024chatcell,
title={ChatCell: Facilitating Single-Cell Analysis with Natural Language},
author={Fang, Yin and Liu, Kangwei and Zhang, Ningyu and Deng, Xinle and Yang, Penghui and Chen, Zhuo and Tang, Xiangru and Gerstein, Mark and Fan, Xiaohui and Chen, Huajun},
year={2024},
}