def _externalize_initializer(cls, dag: OnnxDAG, weights: dict[str, "NDArray"], old_name: str, new_name: str):
        """Create a new initializer with the same shape and type as the old initializer.

        The initializer points to a dummy external location.
        Add the new initializer to the graph and store the weight in a dictionary.

        :param dag: OnnxDAG object
        :param weights: dictionary to store the weights
        :param old_name: name of the initializer to copy
        :param new_name: new initializer name
        """
        assert dag.is_initializer(old_name), f"{old_name} is not an initializer"

        old_proto = dag.get_io(old_name).proto[-1]

        # store the weight in a dictionary
        weights[new_name] = onnx.numpy_helper.to_array(old_proto)

        # copy initializer
        new_initializer = cls._copy_initializer(old_proto, new_name)
        # add the new initializer to the graph
        dag.add_initializer(new_initializer, dag.get_io(old_name).graph_idx)
Create a new initializer with the same shape and type as the old initializer.

        The initializer points to a dummy external location.
        Add the new initializer to the graph and store the weight in a dictionary.

        :param dag: OnnxDAG object
        :param weights: dictionary to store the weights
        :param old_name: name of the initializer to copy
        :param new_name: new initializer name
        
olive/passes/onnx/extract_adapters.py