EMBO / BioMegatron345mCased

huggingface.co
Total runs: 223
24-hour runs: 1
7-day runs: 23
30-day runs: 182
Model's Last Updated: May 31 2022

Introduction of BioMegatron345mCased

Model Details of BioMegatron345mCased

!---

This model has been uploaded to HuggingFace by https://huggingface.co/drAbreu

The model is based on the NVIDIA checkpoint located at

https://catalog.ngc.nvidia.com/orgs/nvidia/models/biomegatron345mcased

-->

BioMegatron is a transformer developed by the Applied Deep Learning Research team at NVIDIA. This particular Megatron model trained on top of the Megatron-LM model, adding a PubMed corpusto the Megatron-LM corpora(Wikipedia, RealNews, OpenWebText, and CC-Stories). BioMegatron follows a similar (albeit not identical) architecture as BERT and it has 345 million parameters:

  • 24 layers
  • 16 attention heads with a hidden size of 1024.

More information available at nVIDIA NGC CATALOG

Running BioMegatron in 🤗 transformers

In this implementation we have followed the commands of the nvidia/megatron-bert-uncased-345m repository to make BioMegatron available in 🤗.

However, the file convert_megatron_bert_checkpoint.py needed a modification. The reason is that the Megatron model shown in nvidia/megatron-bert-uncased-345m has included head layers, while the weights of the BioMegatron model that we upload to this repository do not contain a head.

The code below is a modification of the original convert_megatron_bert_checkpoint.py .

import os
import torch
from convert_biomegatron_checkpoint import convert_megatron_checkpoint

print_checkpoint_structure = True
path_to_checkpoint = "/path/to/BioMegatron345mUncased/"

# Extract the basename.
basename = os.path.dirname(path_to_checkpoint).split('/')[-1]

# Load the model.
input_state_dict = torch.load(os.path.join(path_to_checkpoint, 'model_optim_rng.pt'), map_location="cpu")

# Convert.
print("Converting")
output_state_dict, output_config = convert_megatron_checkpoint(input_state_dict, head_model=False)

# Print the structure of converted state dict.
if print_checkpoint_structure:
    recursive_print(None, output_state_dict)

# Store the config to file.
output_config_file = os.path.join(path_to_checkpoint, "config.json")
print(f'Saving config to "{output_config_file}"')
with open(output_config_file, "w") as f:
    json.dump(output_config, f)

# Store the state_dict to file.
output_checkpoint_file = os.path.join(path_to_checkpoint, "pytorch_model.bin")
print(f'Saving checkpoint to "{output_checkpoint_file}"')
torch.save(output_state_dict, output_checkpoint_file)

We provide in the repository an alternative version of the python script in order to any user to cross-check the validity of the model replicated in this repository.

BioMegatron can be run with the standard 🤗 script for loading models. Here we show an example identical to that of nvidia/megatron-bert-uncased-345m .

import os
import torch
from transformers import BertTokenizer, MegatronBertForMaskedLM, AutoModelForMaskedLM
checkpoint = "EMBO/BioMegatron345mCased"
# The tokenizer. Megatron was trained with standard tokenizer(s).
tokenizer = BertTokenizer.from_pretrained(checkpoint)
# Load the model from $MYDIR/nvidia/megatron-bert-uncased-345m.
model = AutoModelForMaskedLM.from_pretrained(checkpoint)
device = torch.device("cpu")
# Create inputs (from the BERT example page).
input = tokenizer("The capital of France is [MASK]", return_tensors="pt").to(device)
label = tokenizer("The capital of France is Paris",  return_tensors="pt")["input_ids"].to(device)
# Run the model.
with torch.no_grad():
    output = model(**input, labels=label)
    print(output)

Limitations

This implementation has not been fine-tuned in any task. It has only the weights of the official nVIDIA checkpoint. It needs to be trained to perform any downstream task.

Original code

The original code for Megatron can be found here: https://github.com/NVIDIA/Megatron-LM .

Runs of EMBO BioMegatron345mCased on huggingface.co

223
Total runs
1
24-hour runs
11
3-day runs
23
7-day runs
182
30-day runs

More Information About BioMegatron345mCased huggingface.co Model

More BioMegatron345mCased license Visit here:

https://choosealicense.com/licenses/cc-by-4.0

BioMegatron345mCased huggingface.co

BioMegatron345mCased huggingface.co is an AI model on huggingface.co that provides BioMegatron345mCased's model effect (), which can be used instantly with this EMBO BioMegatron345mCased model. huggingface.co supports a free trial of the BioMegatron345mCased model, and also provides paid use of the BioMegatron345mCased. Support call BioMegatron345mCased model through api, including Node.js, Python, http.

BioMegatron345mCased huggingface.co Url

https://huggingface.co/EMBO/BioMegatron345mCased

EMBO BioMegatron345mCased online free

BioMegatron345mCased huggingface.co is an online trial and call api platform, which integrates BioMegatron345mCased's modeling effects, including api services, and provides a free online trial of BioMegatron345mCased, you can try BioMegatron345mCased online for free by clicking the link below.

EMBO BioMegatron345mCased online free url in huggingface.co:

https://huggingface.co/EMBO/BioMegatron345mCased

BioMegatron345mCased install

BioMegatron345mCased is an open source model from GitHub that offers a free installation service, and any user can find BioMegatron345mCased on GitHub to install. At the same time, huggingface.co provides the effect of BioMegatron345mCased install, users can directly use BioMegatron345mCased installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

BioMegatron345mCased install url in huggingface.co:

https://huggingface.co/EMBO/BioMegatron345mCased

Url of BioMegatron345mCased

BioMegatron345mCased huggingface.co Url

Provider of BioMegatron345mCased huggingface.co

EMBO
ORGANIZATIONS

Other API from EMBO

huggingface.co

Total runs: 120
Run Growth: 35
Growth Rate: 29.17%
Updated:November 10 2025
huggingface.co

Total runs: 118
Run Growth: 34
Growth Rate: 28.81%
Updated:November 10 2025
huggingface.co

Total runs: 107
Run Growth: 28
Growth Rate: 26.67%
Updated:January 18 2023
huggingface.co

Total runs: 99
Run Growth: 40
Growth Rate: 40.40%
Updated:March 27 2022
huggingface.co

Total runs: 44
Run Growth: -47
Growth Rate: -100.00%
Updated:March 27 2022
huggingface.co

Total runs: 13
Run Growth: -49
Growth Rate: -306.25%
Updated:March 27 2022
huggingface.co

Total runs: 11
Run Growth: -12
Growth Rate: -92.31%
Updated:October 08 2025
huggingface.co

Total runs: 6
Run Growth: -17
Growth Rate: -283.33%
Updated:November 10 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:September 01 2025