Skip to content

Instantly share code, notes, and snippets.

@zilunpeng
zilunpeng / deploy_gpt_neo_on_sagemaker.ipynb
Last active June 23, 2022 18:15
example notebook for deploying GPT-Neo in AWS Sagemaker
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zilunpeng
zilunpeng / gpt_neo_generation.py
Created May 25, 2021 21:16
example code for running GPT-Neo
"""
Invode the conda environment gpt_neo_generation before running this file.
Specify the prompt in prompt.txt
"""
from transformers import GPTNeoForCausalLM, GPT2Tokenizer
import time
def main():
start_time = time.time()
@zilunpeng
zilunpeng / Training_GPT_Neo.ipynb
Last active June 23, 2022 18:15
example notebook for training GPT-Neo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zilunpeng
zilunpeng / GPT_Neo_playground_public.ipynb
Last active June 23, 2022 18:15
example notebook for running GPT-Neo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zilunpeng
zilunpeng / run_generation.py
Created April 26, 2021 20:50
Generate using a GPT model
#!/usr/bin/env python
# coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@zilunpeng
zilunpeng / run_clm.py
Last active June 23, 2022 18:15
Continue to pre-train GPT models
#!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@zilunpeng
zilunpeng / quantized_wav2vec2_perf.csv
Created March 23, 2021 22:50
Performances of the original wav2vec 2.0 and the quantized model.
Model Name WER Inference Time Model Size # of Parameters Hardware
wav2vec_big_960h 2.63% 4433 s 1262 mb 317 M CPU (8 cores)
Quantized wav2vec_big_960h 2.75% 4079 s 354 mb 317 M CPU (8 cores)
@zilunpeng
zilunpeng / student_wav2vec2_perf.csv
Created March 23, 2021 22:47
Performances of original wav2vec 2.0 and student model
Model Name # of Parameters Model Size CPU (8 cores ) Inference Time GPU Inference Time WER
wav2vec_big_960h 317 M 1262 mb 4433 s 123 s 2.63%
Student wav2vec 2.0 65 M 262 mb 1560 s 51 s 9.51%
@zilunpeng
zilunpeng / wav2vec2_perf.csv
Created March 23, 2021 22:44
Performance of wav2vec 2.0
Model Name WER Inference Time Model Size # of Parameters
wav2vec_big_960h 2.63% 123 s 1262 mb 317 M
@zilunpeng
zilunpeng / calc_wer.py
Created March 23, 2021 22:23
Calculate WER score. Code below is part of the distributed inference notebook (https://git.io/JYeQQ).
from jiwer import wer
wer_score = wer(ground_truths, predictions)