nnsight.schema#
- class nnsight.schema.format.types.BaseNNsightModel(*, type_name: Literal['TYPE_NAME'])[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'type_name': FieldInfo(annotation=Literal['TYPE_NAME'], required=True)}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.DictModel(*, type_name: Literal['TYPE_NAME'])[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'type_name': FieldInfo(annotation=Literal['DICT'], required=False, default='DICT'), 'values': FieldInfo(annotation=Dict[str, Union[int, float, str, bool, NoneType, Annotated[Union[MemoReferenceModel, NodeModel, SliceModel, TensorModel, TupleModel, ListModel, DictModel, FunctionModel, EllipsisModel, InterventionGraphModel, SubGraphModel, GraphModel], FieldInfo(annotation=NoneType, required=True, discriminator='type_name')], Annotated[Union[Annotated[object, BeforeValidator], Annotated[Node, AfterValidator], Annotated[InterventionGraph, AfterValidator], Annotated[SubGraph, AfterValidator], Annotated[Graph, AfterValidator], Annotated[Union[builtin_function_or_method, function, method_descriptor, type], AfterValidator], Annotated[slice, AfterValidator], Annotated[Tensor, AfterValidator], Annotated[tuple, Strict(strict=True), AfterValidator], Annotated[list, AfterValidator], Annotated[dict, AfterValidator], Annotated[ellipsis, AfterValidator]], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]], required=True)}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.EllipsisModel(*, type_name: Literal['ELLIPSIS'] = 'ELLIPSIS')[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'type_name': FieldInfo(annotation=Literal['ELLIPSIS'], required=False, default='ELLIPSIS')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.FunctionModel(*, type_name: Literal['FUNCTION'] = 'FUNCTION', function_name: str)[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'function_name': FieldInfo(annotation=str, required=True), 'type_name': FieldInfo(annotation=Literal['FUNCTION'], required=False, default='FUNCTION')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.GraphModel(*, type_name: Literal['TYPE_NAME'])[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'graph': FieldInfo(annotation=Graph, required=False, default=None, exclude=True, validate_default=False), 'nodes': FieldInfo(annotation=List[Union[MemoReferenceModel, Annotated[Node, AfterValidator]]], required=True), 'type_name': FieldInfo(annotation=Literal['GRAPH'], required=False, default='GRAPH')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.InterventionGraphModel(*, type_name: Literal['INTERVENTIONGRAPH'] = 'INTERVENTIONGRAPH', subset: List[int])[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'subset': FieldInfo(annotation=List[int], required=True), 'type_name': FieldInfo(annotation=Literal['INTERVENTIONGRAPH'], required=False, default='INTERVENTIONGRAPH')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.ListModel(*, type_name: Literal['TYPE_NAME'])[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'type_name': FieldInfo(annotation=Literal['LIST'], required=False, default='LIST'), 'values': FieldInfo(annotation=List[Union[int, float, str, bool, NoneType, Annotated[Union[MemoReferenceModel, NodeModel, SliceModel, TensorModel, TupleModel, ListModel, DictModel, FunctionModel, EllipsisModel, InterventionGraphModel, SubGraphModel, GraphModel], FieldInfo(annotation=NoneType, required=True, discriminator='type_name')], Annotated[Union[Annotated[object, BeforeValidator], Annotated[Node, AfterValidator], Annotated[InterventionGraph, AfterValidator], Annotated[SubGraph, AfterValidator], Annotated[Graph, AfterValidator], Annotated[Union[builtin_function_or_method, function, method_descriptor, type], AfterValidator], Annotated[slice, AfterValidator], Annotated[Tensor, AfterValidator], Annotated[tuple, Strict(strict=True), AfterValidator], Annotated[list, AfterValidator], Annotated[dict, AfterValidator], Annotated[ellipsis, AfterValidator]], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]], required=True)}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.MemoReferenceModel(*, type_name: Literal['REFERENCE'] = 'REFERENCE', id: int)[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'id': FieldInfo(annotation=int, required=True), 'type_name': FieldInfo(annotation=Literal['REFERENCE'], required=False, default='REFERENCE')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.NodeModel(*, type_name: Literal['TYPE_NAME'])[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'args': FieldInfo(annotation=List[Union[int, float, str, bool, NoneType, Annotated[Union[MemoReferenceModel, NodeModel, SliceModel, TensorModel, TupleModel, ListModel, DictModel, FunctionModel, EllipsisModel, InterventionGraphModel, SubGraphModel, GraphModel], FieldInfo(annotation=NoneType, required=True, discriminator='type_name')], Annotated[Union[Annotated[object, BeforeValidator], Annotated[Node, AfterValidator], Annotated[InterventionGraph, AfterValidator], Annotated[SubGraph, AfterValidator], Annotated[Graph, AfterValidator], Annotated[Union[builtin_function_or_method, function, method_descriptor, type], AfterValidator], Annotated[slice, AfterValidator], Annotated[Tensor, AfterValidator], Annotated[tuple, Strict(strict=True), AfterValidator], Annotated[list, AfterValidator], Annotated[dict, AfterValidator], Annotated[ellipsis, AfterValidator]], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]], required=False, default=[]), 'kwargs': FieldInfo(annotation=Dict[str, Union[int, float, str, bool, NoneType, Annotated[Union[MemoReferenceModel, NodeModel, SliceModel, TensorModel, TupleModel, ListModel, DictModel, FunctionModel, EllipsisModel, InterventionGraphModel, SubGraphModel, GraphModel], FieldInfo(annotation=NoneType, required=True, discriminator='type_name')], Annotated[Union[Annotated[object, BeforeValidator], Annotated[Node, AfterValidator], Annotated[InterventionGraph, AfterValidator], Annotated[SubGraph, AfterValidator], Annotated[Graph, AfterValidator], Annotated[Union[builtin_function_or_method, function, method_descriptor, type], AfterValidator], Annotated[slice, AfterValidator], Annotated[Tensor, AfterValidator], Annotated[tuple, Strict(strict=True), AfterValidator], Annotated[list, AfterValidator], Annotated[dict, AfterValidator], Annotated[ellipsis, AfterValidator]], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]], required=False, default={}), 'target': FieldInfo(annotation=Union[int, float, str, bool, NoneType, Annotated[Union[MemoReferenceModel, NodeModel, SliceModel, TensorModel, TupleModel, ListModel, DictModel, FunctionModel, EllipsisModel, InterventionGraphModel, SubGraphModel, GraphModel], FieldInfo(annotation=NoneType, required=True, discriminator='type_name')], Annotated[Union[Annotated[object, BeforeValidator], Annotated[Node, AfterValidator], Annotated[InterventionGraph, AfterValidator], Annotated[SubGraph, AfterValidator], Annotated[Graph, AfterValidator], Annotated[Union[builtin_function_or_method, function, method_descriptor, type], AfterValidator], Annotated[slice, AfterValidator], Annotated[Tensor, AfterValidator], Annotated[tuple, Strict(strict=True), AfterValidator], Annotated[list, AfterValidator], Annotated[dict, AfterValidator], Annotated[ellipsis, AfterValidator]], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], required=True), 'type_name': FieldInfo(annotation=Literal['NODE'], required=False, default='NODE')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.SliceModel(*, type_name: Literal['TYPE_NAME'])[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'start': FieldInfo(annotation=Union[int, float, str, bool, NoneType, Annotated[Union[MemoReferenceModel, NodeModel, SliceModel, TensorModel, TupleModel, ListModel, DictModel, FunctionModel, EllipsisModel, InterventionGraphModel, SubGraphModel, GraphModel], FieldInfo(annotation=NoneType, required=True, discriminator='type_name')], Annotated[Union[Annotated[object, BeforeValidator], Annotated[Node, AfterValidator], Annotated[InterventionGraph, AfterValidator], Annotated[SubGraph, AfterValidator], Annotated[Graph, AfterValidator], Annotated[Union[builtin_function_or_method, function, method_descriptor, type], AfterValidator], Annotated[slice, AfterValidator], Annotated[Tensor, AfterValidator], Annotated[tuple, Strict(strict=True), AfterValidator], Annotated[list, AfterValidator], Annotated[dict, AfterValidator], Annotated[ellipsis, AfterValidator]], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], required=True), 'step': FieldInfo(annotation=Union[int, float, str, bool, NoneType, Annotated[Union[MemoReferenceModel, NodeModel, SliceModel, TensorModel, TupleModel, ListModel, DictModel, FunctionModel, EllipsisModel, InterventionGraphModel, SubGraphModel, GraphModel], FieldInfo(annotation=NoneType, required=True, discriminator='type_name')], Annotated[Union[Annotated[object, BeforeValidator], Annotated[Node, AfterValidator], Annotated[InterventionGraph, AfterValidator], Annotated[SubGraph, AfterValidator], Annotated[Graph, AfterValidator], Annotated[Union[builtin_function_or_method, function, method_descriptor, type], AfterValidator], Annotated[slice, AfterValidator], Annotated[Tensor, AfterValidator], Annotated[tuple, Strict(strict=True), AfterValidator], Annotated[list, AfterValidator], Annotated[dict, AfterValidator], Annotated[ellipsis, AfterValidator]], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], required=True), 'stop': FieldInfo(annotation=Union[int, float, str, bool, NoneType, Annotated[Union[MemoReferenceModel, NodeModel, SliceModel, TensorModel, TupleModel, ListModel, DictModel, FunctionModel, EllipsisModel, InterventionGraphModel, SubGraphModel, GraphModel], FieldInfo(annotation=NoneType, required=True, discriminator='type_name')], Annotated[Union[Annotated[object, BeforeValidator], Annotated[Node, AfterValidator], Annotated[InterventionGraph, AfterValidator], Annotated[SubGraph, AfterValidator], Annotated[Graph, AfterValidator], Annotated[Union[builtin_function_or_method, function, method_descriptor, type], AfterValidator], Annotated[slice, AfterValidator], Annotated[Tensor, AfterValidator], Annotated[tuple, Strict(strict=True), AfterValidator], Annotated[list, AfterValidator], Annotated[dict, AfterValidator], Annotated[ellipsis, AfterValidator]], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], required=True), 'type_name': FieldInfo(annotation=Literal['SLICE'], required=False, default='SLICE')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.SubGraphModel(*, type_name: Literal['SUBGRAPH'] = 'SUBGRAPH', subset: List[int])[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'subset': FieldInfo(annotation=List[int], required=True), 'type_name': FieldInfo(annotation=Literal['SUBGRAPH'], required=False, default='SUBGRAPH')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.TensorModel(*, type_name: Literal['TENSOR'] = 'TENSOR', values: List, dtype: str)[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'dtype': FieldInfo(annotation=str, required=True), 'type_name': FieldInfo(annotation=Literal['TENSOR'], required=False, default='TENSOR'), 'values': FieldInfo(annotation=List, required=True)}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class nnsight.schema.format.types.TupleModel(*, type_name: Literal['TYPE_NAME'])[source]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'type_name': FieldInfo(annotation=Literal['TUPLE'], required=False, default='TUPLE'), 'values': FieldInfo(annotation=List[Union[int, float, str, bool, NoneType, Annotated[Union[MemoReferenceModel, NodeModel, SliceModel, TensorModel, TupleModel, ListModel, DictModel, FunctionModel, EllipsisModel, InterventionGraphModel, SubGraphModel, GraphModel], FieldInfo(annotation=NoneType, required=True, discriminator='type_name')], Annotated[Union[Annotated[object, BeforeValidator], Annotated[Node, AfterValidator], Annotated[InterventionGraph, AfterValidator], Annotated[SubGraph, AfterValidator], Annotated[Graph, AfterValidator], Annotated[Union[builtin_function_or_method, function, method_descriptor, type], AfterValidator], Annotated[slice, AfterValidator], Annotated[Tensor, AfterValidator], Annotated[tuple, Strict(strict=True), AfterValidator], Annotated[list, AfterValidator], Annotated[dict, AfterValidator], Annotated[ellipsis, AfterValidator]], FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]]], required=True)}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.