This file contains 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
# Copyright (c) Meta Platforms, Inc. and affiliates. | |
# This software may be used and distributed according to the terms of the Llama 2 Community License Agreement. | |
import math | |
from dataclasses import dataclass | |
from typing import Optional, Tuple | |
# import fairscale.nn.model_parallel.initialize as fs_init | |
import torch | |
import torch.nn.functional as F |
This file contains 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 torch | |
ref_model_sd = torch.load("ckpt_ref/meta_model_0.pt", weights_only=True) | |
real_model_sd = torch.load("ckpt_new/meta_model_0.pt", weights_only=True) | |
for k, v in ref_model_sd.items(): | |
assert torch.equal(v, real_model_sd[k]) |
This file contains 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 torch | |
from torchgen.model import DispatchKey | |
num_impl_registrations = 0 | |
registration_dict = {} | |
failed_keys = set() | |
# === Collect number of kernel registrations for each dispatch key === | |
for key in DispatchKey: | |
try: |