Run this model with HF Jobs
Run InstaDeepAI/ChatNT on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/InstaDeepAI/ChatNT. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/InstaDeepAI/ChatNT on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/InstaDeepAI/ChatNT. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/InstaDeepAI/ChatNT. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("InstaDeepAI/ChatNT", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- 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
Update chatNT.py
Browse files416 unmodified lines4174184194204214224234244254261 unmodified line42842943043143243343436 unmodified lines4714724734744754764774789 unmodified lines48848949049149249349410 unmodified lines505506507508509510511168 unmodified lines68068168268368468512 unmodified lines69869970070170270370470518 unmodified lines724725726727728729730731732416 unmodified lines# Insert the bio embeddings at the SEQ token positionsprocessed_tokens_ids = english_token_ids.clone()print("(debug) Before call tokens embeddings shape : ", tokens_embeddings.shape)print("(debug) Before call Processed tokens ids shape : ", processed_tokens_ids.shape)print("(debug) Before call Projected bio embeddings shape : ", projected_bio_embeddings.shape)print("num bio sequences : ", num_bio_sequences)for bio_seq_num in range(num_bio_sequences):tokens_embeddings, processed_tokens_ids = self.insert_embeddings(processed_tokens_ids,1 unmodified lineprojected_bio_embeddings[:, bio_seq_num, :, :],bio_seq_num=bio_seq_num,)print("After call : ", tokens_embeddings.shape)# Regular GPT pass throughembeddings = self.gpt_model.apply_transformer_layers(tokens_embeddings)36 unmodified lines- input_embeddings with resampled_embeddings inserted at the SEQ token- tokens with the SEQ token set to -1"""print("Tokens : ", list(tokens))print("seq_token_id : ", self.seq_token_id)def _insert(tokens_1d: torch.Tensor,9 unmodified lines"""indices = torch.where(tokens_1d == self.seq_token_id)[0]if indices.numel() > 0:print("going in if")idx = indices[0].item()insertion_pos = idx + resampled_embeddings_1d.shape[-2] * bio_seq_numx = torch.cat(10 unmodified linestokens_1d[idx] = -1return x, tokens_1delse:print("going in else")return (input_embeddings,tokens_1d,168 unmodified linesShape (batch_size, num_bio_sequences, ?, embed_dim)"""english_token_ids, bio_token_ids = multi_omics_tokens_ids# Replace config.vocab_size value in english tokens# We do this because the default vocab size (32000) doesn't match with the12 unmodified linesvocab_size - 1)print("seq token id : ", self.seq_token_id)print("Tokens at step 1 in multiomics : ", list(english_token_ids))if bio_token_ids is None:projected_bio_embeddings = Noneelse:18 unmodified lines]projected_bio_embeddings = torch.stack(projected_bio_embeddings, dim=1)# decodeprint("Tokens at step 2 in multiomics : ", list(english_token_ids))logits = self.biobrain_decoder(english_token_ids=english_token_ids,projected_bio_embeddings=projected_bio_embeddings,416 unmodified lines4174184194204214221 unmodified line42442542642742842936 unmodified lines4664674684694704719 unmodified lines48148248348448548610 unmodified lines497498499500501502168 unmodified lines67167267367467567667767867968068112 unmodified lines69469569669769869918 unmodified lines718719720721722723724416 unmodified lines# Insert the bio embeddings at the SEQ token positionsprocessed_tokens_ids = english_token_ids.clone()for bio_seq_num in range(num_bio_sequences):tokens_embeddings, processed_tokens_ids = self.insert_embeddings(processed_tokens_ids,1 unmodified lineprojected_bio_embeddings[:, bio_seq_num, :, :],bio_seq_num=bio_seq_num,)# Regular GPT pass throughembeddings = self.gpt_model.apply_transformer_layers(tokens_embeddings)36 unmodified lines- input_embeddings with resampled_embeddings inserted at the SEQ token- tokens with the SEQ token set to -1"""def _insert(tokens_1d: torch.Tensor,9 unmodified lines"""indices = torch.where(tokens_1d == self.seq_token_id)[0]if indices.numel() > 0:idx = indices[0].item()insertion_pos = idx + resampled_embeddings_1d.shape[-2] * bio_seq_numx = torch.cat(10 unmodified linestokens_1d[idx] = -1return x, tokens_1delse:return (input_embeddings,tokens_1d,168 unmodified linesShape (batch_size, num_bio_sequences, ?, embed_dim)"""english_token_ids, bio_token_ids = multi_omics_tokens_idsenglish_token_ids = english_token_ids.clone()bio_token_ids = bio_token_ids.clone()projection_english_tokens_ids = projection_english_tokens_ids.clone()if projected_bio_embeddings is not None:projected_bio_embeddings = projected_bio_embeddings.clone()# Replace config.vocab_size value in english tokens# We do this because the default vocab size (32000) doesn't match with the12 unmodified linesvocab_size - 1)if bio_token_ids is None:projected_bio_embeddings = Noneelse:18 unmodified lines]projected_bio_embeddings = torch.stack(projected_bio_embeddings, dim=1)# decodelogits = self.biobrain_decoder(english_token_ids=english_token_ids,projected_bio_embeddings=projected_bio_embeddings,
chatNT.py+6-14