danf0 commited on
Commit
41e5c28
1 Parent(s): 9495639

Try dynamic value type again

Browse files
Files changed (1) hide show
  1. vendiscore.py +18 -13
vendiscore.py CHANGED
@@ -82,6 +82,23 @@ def get_dtype(config_name):
82
  return datasets.Value(config_name)
83
 
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  @evaluate.utils.file_utils.add_start_docstrings(
86
  _DESCRIPTION, _KWARGS_DESCRIPTION
87
  )
@@ -96,19 +113,7 @@ class VendiScore(evaluate.Metric):
96
  description=_DESCRIPTION,
97
  citation=_CITATION,
98
  inputs_description=_KWARGS_DESCRIPTION,
99
- features=[
100
- datasets.Features({"samples": datasets.Value("string")}),
101
- datasets.Features({"samples": datasets.Value("int32")}),
102
- datasets.Features(
103
- {"samples": datasets.Sequence(datasets.Value("int32"))}
104
- ),
105
- datasets.Features({"samples": datasets.Value("float")}),
106
- datasets.Features(
107
- {"samples": datasets.Sequence(datasets.Value("float"))}
108
- ),
109
- datasets.Features({"samples": datasets.Image}),
110
- datasets.Features({"samples": datasets.Array2D}),
111
- ],
112
  homepage="http://github.com/Vertaix/Vendi-Score",
113
  codebase_urls=["http://github.com/Vertaix/Vendi-Score"],
114
  reference_urls=[],
 
82
  return datasets.Value(config_name)
83
 
84
 
85
+ def get_features(config_name):
86
+ if config_name in ("text", "default"):
87
+ return datasets.Features({"samples": datasets.Value("string")})
88
+ return [
89
+ datasets.Features({"samples": datasets.Value("int32")}),
90
+ datasets.Features(
91
+ {"samples": datasets.Sequence(datasets.Value("int32"))}
92
+ ),
93
+ datasets.Features({"samples": datasets.Value("float")}),
94
+ datasets.Features(
95
+ {"samples": datasets.Sequence(datasets.Value("float"))}
96
+ ),
97
+ datasets.Features({"samples": datasets.Image}),
98
+ datasets.Features({"samples": datasets.Array2D}),
99
+ ]
100
+
101
+
102
  @evaluate.utils.file_utils.add_start_docstrings(
103
  _DESCRIPTION, _KWARGS_DESCRIPTION
104
  )
 
113
  description=_DESCRIPTION,
114
  citation=_CITATION,
115
  inputs_description=_KWARGS_DESCRIPTION,
116
+ features=get_features(self.config_name),
 
 
 
 
 
 
 
 
 
 
 
 
117
  homepage="http://github.com/Vertaix/Vendi-Score",
118
  codebase_urls=["http://github.com/Vertaix/Vendi-Score"],
119
  reference_urls=[],