Add raw system metadata
Browse files- croissant.json +65 -15
- util/croissant.py +47 -2
croissant.json
CHANGED
|
@@ -49,7 +49,7 @@
|
|
| 49 |
"description": "ELCC is a collection of emergent language corpora with accompanying metadata and analyses.",
|
| 50 |
"conformsTo": "http://mlcommons.org/croissant/1.0",
|
| 51 |
"citeAs": "@misc{boldt2024elcc,\n title = \"{ELCC}: the Emergent Language Corpus Collection\",\n author = \"Brendon Boldt and David Mortensen\",\n year = 2024,\n url = \"https://huggingface.co/datasets/bboldt/elcc\",\n}",
|
| 52 |
-
"datePublished": "2024-06-13
|
| 53 |
"keywords": [
|
| 54 |
"emergent communication",
|
| 55 |
"emergent language",
|
|
@@ -77,6 +77,16 @@
|
|
| 77 |
"encodingFormat": "application/json",
|
| 78 |
"includes": "systems/*/system.json"
|
| 79 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
{
|
| 81 |
"@type": "cr:FileObject",
|
| 82 |
"@id": "systems/babyai-sr/data/GoToObj/corpus.json",
|
|
@@ -809,11 +819,65 @@
|
|
| 809 |
}
|
| 810 |
],
|
| 811 |
"recordSet": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 812 |
{
|
| 813 |
"@type": "cr:RecordSet",
|
| 814 |
"@id": "system-metadata",
|
| 815 |
"name": "system-metadata",
|
| 816 |
"field": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 817 |
{
|
| 818 |
"@type": "cr:Field",
|
| 819 |
"@id": "system-metadata/origin.name",
|
|
@@ -926,20 +990,6 @@
|
|
| 926 |
}
|
| 927 |
}
|
| 928 |
},
|
| 929 |
-
{
|
| 930 |
-
"@type": "cr:Field",
|
| 931 |
-
"@id": "system-metadata/system.variants",
|
| 932 |
-
"name": "system.variants",
|
| 933 |
-
"dataType": "sc:Text",
|
| 934 |
-
"source": {
|
| 935 |
-
"fileSet": {
|
| 936 |
-
"@id": "system-metadata-files"
|
| 937 |
-
},
|
| 938 |
-
"extract": {
|
| 939 |
-
"jsonPath": "$.system.variants"
|
| 940 |
-
}
|
| 941 |
-
}
|
| 942 |
-
},
|
| 943 |
{
|
| 944 |
"@type": "cr:Field",
|
| 945 |
"@id": "system-metadata/system.game_subtype",
|
|
|
|
| 49 |
"description": "ELCC is a collection of emergent language corpora with accompanying metadata and analyses.",
|
| 50 |
"conformsTo": "http://mlcommons.org/croissant/1.0",
|
| 51 |
"citeAs": "@misc{boldt2024elcc,\n title = \"{ELCC}: the Emergent Language Corpus Collection\",\n author = \"Brendon Boldt and David Mortensen\",\n year = 2024,\n url = \"https://huggingface.co/datasets/bboldt/elcc\",\n}",
|
| 52 |
+
"datePublished": "2024-06-13 06:42:12.302053+00:00",
|
| 53 |
"keywords": [
|
| 54 |
"emergent communication",
|
| 55 |
"emergent language",
|
|
|
|
| 77 |
"encodingFormat": "application/json",
|
| 78 |
"includes": "systems/*/system.json"
|
| 79 |
},
|
| 80 |
+
{
|
| 81 |
+
"@type": "cr:FileSet",
|
| 82 |
+
"@id": "system-metadata-files-raw",
|
| 83 |
+
"name": "system-metadata-files-raw",
|
| 84 |
+
"containedIn": {
|
| 85 |
+
"@id": "repo"
|
| 86 |
+
},
|
| 87 |
+
"encodingFormat": "text/plain",
|
| 88 |
+
"includes": "systems/*/system.json"
|
| 89 |
+
},
|
| 90 |
{
|
| 91 |
"@type": "cr:FileObject",
|
| 92 |
"@id": "systems/babyai-sr/data/GoToObj/corpus.json",
|
|
|
|
| 819 |
}
|
| 820 |
],
|
| 821 |
"recordSet": [
|
| 822 |
+
{
|
| 823 |
+
"@type": "cr:RecordSet",
|
| 824 |
+
"@id": "system-metadata-raw",
|
| 825 |
+
"name": "system-metadata-raw",
|
| 826 |
+
"field": [
|
| 827 |
+
{
|
| 828 |
+
"@type": "cr:Field",
|
| 829 |
+
"@id": "system-metadata-raw/path",
|
| 830 |
+
"name": "path",
|
| 831 |
+
"dataType": "sc:Text",
|
| 832 |
+
"references": {
|
| 833 |
+
"field": {
|
| 834 |
+
"@id": "system-metadata/path"
|
| 835 |
+
}
|
| 836 |
+
},
|
| 837 |
+
"source": {
|
| 838 |
+
"fileSet": {
|
| 839 |
+
"@id": "system-metadata-files-raw"
|
| 840 |
+
},
|
| 841 |
+
"extract": {
|
| 842 |
+
"fileProperty": "fullpath"
|
| 843 |
+
}
|
| 844 |
+
}
|
| 845 |
+
},
|
| 846 |
+
{
|
| 847 |
+
"@type": "cr:Field",
|
| 848 |
+
"@id": "system-metadata-raw/raw",
|
| 849 |
+
"name": "raw",
|
| 850 |
+
"dataType": "sc:Text",
|
| 851 |
+
"source": {
|
| 852 |
+
"fileSet": {
|
| 853 |
+
"@id": "system-metadata-files-raw"
|
| 854 |
+
},
|
| 855 |
+
"extract": {
|
| 856 |
+
"fileProperty": "content"
|
| 857 |
+
}
|
| 858 |
+
}
|
| 859 |
+
}
|
| 860 |
+
]
|
| 861 |
+
},
|
| 862 |
{
|
| 863 |
"@type": "cr:RecordSet",
|
| 864 |
"@id": "system-metadata",
|
| 865 |
"name": "system-metadata",
|
| 866 |
"field": [
|
| 867 |
+
{
|
| 868 |
+
"@type": "cr:Field",
|
| 869 |
+
"@id": "system-metadata/path",
|
| 870 |
+
"name": "path",
|
| 871 |
+
"dataType": "sc:Text",
|
| 872 |
+
"source": {
|
| 873 |
+
"fileSet": {
|
| 874 |
+
"@id": "system-metadata-files"
|
| 875 |
+
},
|
| 876 |
+
"extract": {
|
| 877 |
+
"fileProperty": "fullpath"
|
| 878 |
+
}
|
| 879 |
+
}
|
| 880 |
+
},
|
| 881 |
{
|
| 882 |
"@type": "cr:Field",
|
| 883 |
"@id": "system-metadata/origin.name",
|
|
|
|
| 990 |
}
|
| 991 |
}
|
| 992 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 993 |
{
|
| 994 |
"@type": "cr:Field",
|
| 995 |
"@id": "system-metadata/system.game_subtype",
|
util/croissant.py
CHANGED
|
@@ -27,6 +27,13 @@ _distribution: list[mlc.FileObject | mlc.FileSet] = [
|
|
| 27 |
includes=["systems/*/system.json"],
|
| 28 |
encoding_format="application/json",
|
| 29 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
]
|
| 31 |
|
| 32 |
_metadata = mlc.Metadata(
|
|
@@ -120,13 +127,51 @@ def make_system_field(base_name: str, typ: type | None) -> mlc.Field:
|
|
| 120 |
source=mlc.Source(
|
| 121 |
file_set="system-metadata-files",
|
| 122 |
extract=mlc.Extract(json_path=jp),
|
| 123 |
-
# extract=mlc.Extract(file_property="filename"),
|
| 124 |
),
|
| 125 |
)
|
| 126 |
|
| 127 |
|
| 128 |
def insert_system_md(metadata: mlc.Metadata) -> None:
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
for k0, v0 in validate.SystemMetadata.model_fields.items():
|
| 131 |
assert v0.annotation is not None
|
| 132 |
if isinstance(v0.annotation, type) and issubclass(
|
|
|
|
| 27 |
includes=["systems/*/system.json"],
|
| 28 |
encoding_format="application/json",
|
| 29 |
),
|
| 30 |
+
mlc.FileSet(
|
| 31 |
+
id="system-metadata-files-raw",
|
| 32 |
+
name="system-metadata-files-raw",
|
| 33 |
+
contained_in=["repo"],
|
| 34 |
+
includes=["systems/*/system.json"],
|
| 35 |
+
encoding_format="text/plain",
|
| 36 |
+
),
|
| 37 |
]
|
| 38 |
|
| 39 |
_metadata = mlc.Metadata(
|
|
|
|
| 127 |
source=mlc.Source(
|
| 128 |
file_set="system-metadata-files",
|
| 129 |
extract=mlc.Extract(json_path=jp),
|
|
|
|
| 130 |
),
|
| 131 |
)
|
| 132 |
|
| 133 |
|
| 134 |
def insert_system_md(metadata: mlc.Metadata) -> None:
|
| 135 |
+
metadata.record_sets.append(
|
| 136 |
+
mlc.RecordSet(
|
| 137 |
+
id="system-metadata-raw",
|
| 138 |
+
name="system-metadata-raw",
|
| 139 |
+
fields=[
|
| 140 |
+
mlc.Field(
|
| 141 |
+
id="system-metadata-raw/path",
|
| 142 |
+
name="path",
|
| 143 |
+
data_types=[mlc.DataType.TEXT],
|
| 144 |
+
source=mlc.Source(
|
| 145 |
+
file_set="system-metadata-files-raw",
|
| 146 |
+
extract=mlc.Extract(file_property=mlc.FileProperty.fullpath),
|
| 147 |
+
),
|
| 148 |
+
# References always seem to cause conflicting read method errors.
|
| 149 |
+
# references={"field": {"@id": "system-metadata/path"}},
|
| 150 |
+
),
|
| 151 |
+
mlc.Field(
|
| 152 |
+
id="system-metadata-raw/raw",
|
| 153 |
+
name="raw",
|
| 154 |
+
data_types=[mlc.DataType.TEXT],
|
| 155 |
+
source=mlc.Source(
|
| 156 |
+
file_set="system-metadata-files-raw",
|
| 157 |
+
extract=mlc.Extract(file_property=mlc.FileProperty.content),
|
| 158 |
+
),
|
| 159 |
+
),
|
| 160 |
+
],
|
| 161 |
+
)
|
| 162 |
+
)
|
| 163 |
+
|
| 164 |
+
fields = [
|
| 165 |
+
mlc.Field(
|
| 166 |
+
id="system-metadata/path",
|
| 167 |
+
name="path",
|
| 168 |
+
data_types=[mlc.DataType.TEXT],
|
| 169 |
+
source=mlc.Source(
|
| 170 |
+
file_set="system-metadata-files",
|
| 171 |
+
extract=mlc.Extract(file_property=mlc.FileProperty.fullpath),
|
| 172 |
+
),
|
| 173 |
+
),
|
| 174 |
+
]
|
| 175 |
for k0, v0 in validate.SystemMetadata.model_fields.items():
|
| 176 |
assert v0.annotation is not None
|
| 177 |
if isinstance(v0.annotation, type) and issubclass(
|