Instructions to use InstaDeepAI/ChatNT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use InstaDeepAI/ChatNT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="InstaDeepAI/ChatNT", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("InstaDeepAI/ChatNT", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use InstaDeepAI/ChatNT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "InstaDeepAI/ChatNT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "InstaDeepAI/ChatNT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/InstaDeepAI/ChatNT
- SGLang
How to use InstaDeepAI/ChatNT 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 "InstaDeepAI/ChatNT" \ --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": "InstaDeepAI/ChatNT", "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 "InstaDeepAI/ChatNT" \ --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": "InstaDeepAI/ChatNT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use InstaDeepAI/ChatNT with Docker Model Runner:
docker model run hf.co/InstaDeepAI/ChatNT
Delete chatNT_config.py
Browse files- chatNT_config.py +0 -50
chatNT_config.py
DELETED
|
@@ -1,50 +0,0 @@
|
|
| 1 |
-
from dataclasses import dataclass
|
| 2 |
-
|
| 3 |
-
from transformers import PretrainedConfig
|
| 4 |
-
|
| 5 |
-
from genomics_research.biobrain_p1.porting_to_pytorch.configs.esm_config import (
|
| 6 |
-
ESMTransformerConfig,
|
| 7 |
-
)
|
| 8 |
-
from genomics_research.biobrain_p1.porting_to_pytorch.configs.gpt_config import (
|
| 9 |
-
GptConfig,
|
| 10 |
-
)
|
| 11 |
-
from genomics_research.biobrain_p1.porting_to_pytorch.configs.perceiver_resampler_config import ( # noqa
|
| 12 |
-
PerceiverResamplerConfig,
|
| 13 |
-
)
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
@dataclass
|
| 17 |
-
class ChatNTConfig(PretrainedConfig):
|
| 18 |
-
model_type = "ChatNT"
|
| 19 |
-
|
| 20 |
-
def __init__(self, **kwargs): # type: ignore
|
| 21 |
-
self.gpt_config: GptConfig = kwargs.get("gpt_config", GptConfig(32000, 3))
|
| 22 |
-
self.esm_config: ESMTransformerConfig = kwargs.get(
|
| 23 |
-
"esm_config", ESMTransformerConfig(4000, 1, 4)
|
| 24 |
-
)
|
| 25 |
-
self.perceiver_resampler_config: PerceiverResamplerConfig = kwargs.get(
|
| 26 |
-
"perceiver_resampler_config", PerceiverResamplerConfig()
|
| 27 |
-
)
|
| 28 |
-
self.seq_token_id: int = kwargs.get("seq_token_id", 32000)
|
| 29 |
-
self.bio_pad_token_id: int = kwargs.get("bio_pad_token_id", 1)
|
| 30 |
-
self.english_pad_token_id: int = kwargs.get("english_pad_token_id", 2)
|
| 31 |
-
super().__init__(**kwargs)
|
| 32 |
-
|
| 33 |
-
def to_dict(self): # type: ignore
|
| 34 |
-
print("(debug) Going into ChatNTConfig to_dict")
|
| 35 |
-
output = super().to_dict()
|
| 36 |
-
|
| 37 |
-
def serialize(obj): # type: ignore
|
| 38 |
-
return obj.to_dict() if hasattr(obj, "to_dict") else vars(obj)
|
| 39 |
-
|
| 40 |
-
print("(debug) Before serialize gpt_config to_dict")
|
| 41 |
-
output["gpt_config"] = serialize(self.gpt_config) # type: ignore
|
| 42 |
-
print("(debug) Before serialize esm_config to_dict")
|
| 43 |
-
output["esm_config"] = serialize(self.esm_config) # type: ignore
|
| 44 |
-
print("(debug) Before serialize perceiver_resampler_config to_dict")
|
| 45 |
-
output["perceiver_resampler_config"] = serialize( # type: ignore
|
| 46 |
-
self.perceiver_resampler_config
|
| 47 |
-
)
|
| 48 |
-
print("(debug) after serializing all ")
|
| 49 |
-
print("(debug) output : ", output)
|
| 50 |
-
return output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|