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 files404 unmodified lines4054064074084084104094104115 unmodified lines4174184194204224234214224234244254264 unmodified lines43143243343443443543634 unmodified lines4714724734744754764774784794804817 unmodified lines48949049149249349449510 unmodified lines50650750850951051151212 unmodified lines525526527528529530531532533534535174 unmodified lines7107117127047137147157167177107187197204 unmodified lines725726727721728723729730726727728731732733167 unmodified lines90190290390290490590675 unmodified lines982983984984985986987404 unmodified lines """
# Compute English token embeddings print("(debug) in biobraindecoder, english tokens ids : ", english_token_ids.shape) tokens_embeddings = self.gpt_model.token_embed(english_token_ids) print("(debug) tokens_embeddings shape : ", tokens_embeddings.shape)
if projected_bio_embeddings is not None: (5 unmodified lines # Insert the bio embeddings at the SEQ token positions processed_tokens_ids = english_token_ids.clone() print("(debug) Before call tokens embeddings shape : ", tokens_embeddings.shape) print("(debug) Inside : processed tokens ids shape : ", processed_tokens_ids.shape) print("(debug) Inside : projected bio embeddings shape : ", projected_bio_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,4 unmodified lines print("After call : ", tokens_embeddings.shape)
# Regular GPT pass through print("(debug) tokens embeddings shape : ", tokens_embeddings.shape) embeddings = self.gpt_model.apply_transformer_layers(tokens_embeddings) embeddings = self.gpt_model.final_norm(embeddings)
34 unmodified lines - input_embeddings with resampled_embeddings inserted at the SEQ token - tokens with the SEQ token set to -1 """ print("Insert_embeddings input shape : ") print("Tokens : ", tokens.shape) print("Input embeddings : ", input_embeddings.shape) print("Resampled embeddings : ", resampled_embeddings.shape) print("Bio seq num : ", bio_seq_num)
def _insert( tokens_1d: torch.Tensor,7 unmodified lines resampled_embeddings (torch.Tensor): Shape (bio_sequence_length, embed_dim,) """ print("_insert input : ", input_embeddings_1d.shape, resampled_embeddings_1d.shape) indices = torch.where(tokens_1d == self.seq_token_id)[0] if indices.numel() > 0: idx = indices[0].item()10 unmodified lines :-1, : ] tokens_1d[idx] = -1 print("_insert output : ", x.shape) return x, tokens_1d else: return (12 unmodified lines ) tokens_acc.append(tokens_out) embeddings_acc.append(embeddings_out)
print("(Embeddings_acc[0] shape : ", embeddings_acc[0].shape) tokens_acc = torch.stack(tokens_acc) embeddings_acc = torch.stack(embeddings_acc) print("Embeddings acc shape : ", embeddings_acc.shape)
return embeddings_acc, tokens_acc
174 unmodified lines
if projected_bio_embeddings is None: # Compute bio sequences embeddings print("(debug) shape bio tokens ids : ", bio_token_ids.shape) bio_embeddings_list = [ self.biobrain_encoder(bio_token_ids=bio_token_ids[:, bio_seq_num]) for bio_seq_num in range(num_bio_sequences) ]
print("(debug) shape of embeddings : ", bio_embeddings_list[0].shape)
# Project these embeddings projected_bio_embeddings = [4 unmodified lines ) for bio_seq_num, bio_embeddings in enumerate(bio_embeddings_list) ] print("(debug) Shape output projection model : ", projected_bio_embeddings[0].shape) projected_bio_embeddings = torch.stack(projected_bio_embeddings, dim=1) print("(debug) Shape projected bio embeddings : ", projected_bio_embeddings.shape)
# decode print("(debug) Going in biobrain decoder : ") print("(debug) English token ids : ", english_token_ids.shape) print("(debug) Projected bio embeddings : ", projected_bio_embeddings.shape) logits = self.biobrain_decoder( english_token_ids=english_token_ids, projected_bio_embeddings=projected_bio_embeddings,167 unmodified lines value_inputs: torch.Tensor, attention_mask: torch.Tensor = None, ) -> torch.Tensor: print("(debug) Query input shape : ", query_inputs.shape) batch_size, seq_len, _ = query_inputs.shape
queries = self.query_linear(query_inputs).view( # noqa75 unmodified lines if attention_mask is None: attention_mask = build_causal_attention_mask(1, embeddings.shape[1]) for layer in self.layers: print("Embedding shape in apply_transformer_layers : ", embeddings.shape) embeddings = layer(embeddings, attention_mask)
return embeddingschatNT.py+14-14