Skip to main content
Once you have trained a language model on Cerebras’s Wafer-Scale cluster, you may port it to Hugging Face to generate outputs. For more information, refer to Convert Checkpoints and Model Configs.
This guide uses an example from Spring 2023 with CerebrasGPT which uses release 1.8 (cs-1.8) as the source format.

Procedure

  1. To use the conversion script convert_checkpoint.py, activate the Cerebras virtual environment and specify the following flags:
  1. Convert the checkpoint obtained from fine-tuning “Cerebras-GPT 111M” included in the model directory finetune_GPT111M.
  1. To facilitate importing the model in Hugging Face, modify the configuration file’s name to include gpt2 in it.
Now the trained models can be used with Hugging Face.
  1. Create a Python virtual environment to use Hugging Face.
Before you proceed, deactivate the venv_cerebras_pt environment.
  1. Once you have set up the virtual environment, you can now generate outputs using Hugging Face. The tokenizer can be found in Cerebras-GPT-111M available in Hugging Face. Here is an example using the model trained from scratch:
Here is an example using the model fine-tuned using Cerebras-GPT checkpoint: