This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # script to decompose/recompose llama model in different number of shards | |
| # note that it loads the full model * 2 in cpu memory | |
| import os | |
| import json | |
| import sys | |
| import torch | |
| import glob | |
| if len(sys.argv) != 4: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import inspect | |
| import logging | |
| import os | |
| from pathlib import Path | |
| import torch | |
| from psutil import cpu_count | |
| from transformers import T5Config, T5ForConditionalGeneration, T5Tokenizer | |
| from transformers.generation_utils import GenerationMixin | |
| from transformers.modeling_outputs import BaseModelOutputWithPast, Seq2SeqLMOutput |