Text Generation
Transformers
PyTorch
t5
text2text-generation
biology
single-cell
single-cell analysis
text-generation-inference
Instructions to use zjunlp/chatcell-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zjunlp/chatcell-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zjunlp/chatcell-large")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("zjunlp/chatcell-large") model = AutoModelForSeq2SeqLM.from_pretrained("zjunlp/chatcell-large", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use zjunlp/chatcell-large with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zjunlp/chatcell-large" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zjunlp/chatcell-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/zjunlp/chatcell-large
- SGLang
How to use zjunlp/chatcell-large with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "zjunlp/chatcell-large" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zjunlp/chatcell-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "zjunlp/chatcell-large" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zjunlp/chatcell-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use zjunlp/chatcell-large with Docker Model Runner:
docker model run hf.co/zjunlp/chatcell-large
Update README.md
Browse files
README.md
CHANGED
|
@@ -108,6 +108,13 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
| 108 |
|
| 109 |
tokenizer = AutoTokenizer.from_pretrained("zjunlp/chatcell-large")
|
| 110 |
model = AutoModelForSeq2SeqLM.from_pretrained("zjunlp/chatcell-large")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
```
|
| 112 |
|
| 113 |
|
|
|
|
| 108 |
|
| 109 |
tokenizer = AutoTokenizer.from_pretrained("zjunlp/chatcell-large")
|
| 110 |
model = AutoModelForSeq2SeqLM.from_pretrained("zjunlp/chatcell-large")
|
| 111 |
+
input_text="Detail the 100 starting genes for a Mix, ranked by expression level: "
|
| 112 |
+
# Encode the input text and generate a response with specified generation parameters
|
| 113 |
+
input_ids = tokenizer(input_text,return_tensors="pt").input_ids
|
| 114 |
+
output_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)
|
| 115 |
+
# Decode and print the generated output text
|
| 116 |
+
output_text = tokenizer.decode(output_ids[0],skip_special_tokens=True)
|
| 117 |
+
print(output_text)
|
| 118 |
```
|
| 119 |
|
| 120 |
|