Coder Social home page Coder Social logo

llm_ckpt_script's Introduction

Example checkpoint loading script

This is an example script to load layer(s) of the saved checkpoint into NumPy array(s) for the LLM benchmark.

Requirement

TensorStore

Usage

Assuming the checkpoint has been downloaded to /data, the following command will load the weights of self_attention.combined_qkv.w for all 96 GPT-3 blocks.

python3 ./load_ts_ckpt.py \
--input_path /data/gpt3_spmd1x192x8_tpuv4-3072_20220511/checkpoints/checkpoint_00000200/mdl_vars.params.lm.transformer.repeat.sub.x_layers_0.self_attention.combined_qkv.w/

Please use a machine with sufficient memory; the largest single directory is more than 200GB in size. It may take a few minutes to load a directory, depending on the machine specs and the size of the layer(s). Below is an output from running the command above:

path =  /data/gpt3_spmd1x192x8_tpuv4-3072_20220511/checkpoints/checkpoint_00000200/mdl_vars.params.lm.transformer.repeat.sub.x_layers_0.self_attention.combined_qkv.w/ , type =  <class 'numpy.ndarray'> , shape =  (96, 3, 12288, 96, 128)

The script has been tested using Python 3.7.8 and TensorStore 0.1.20.

llm_ckpt_script's People

Contributors

sgpyc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.