microsoft/qlib · error · NotImplementedError
This type of input is not supported
Error message
This type of input is not supported
What it means
MetaDataset.prepare (qlib/model/meta/dataset.py:66) accepts segments either as a single segment name (str) or a list/tuple of segment names, dispatching to _prepare_seg. Any other type (None, dict, int, a segments object) raises NotImplementedError('This type of input is not supported'). This enforces that meta-task preparation is keyed by named segments defined in the task.
Source
Thrown at qlib/model/meta/dataset.py:66
train_meta_tasks, test_meta_tasks = meta_dataset.prepare_tasks(["train", "test"])
Parameters
----------
segments: Union[List[Text], Tuple[Text], Text]
the info to select data
Returns
-------
list:
A list of the prepared data of each meta-task for training the meta-model. For multiple segments [seg1, seg2, ... , segN], the returned list will be [[tasks in seg1], [tasks in seg2], ... , [tasks in segN]].
Each task is a meta task
"""
if isinstance(segments, (list, tuple)):
return [self._prepare_seg(seg) for seg in segments]
elif isinstance(segments, str):
return self._prepare_seg(segments)
else:
raise NotImplementedError(f"This type of input is not supported")
@abc.abstractmethod
def _prepare_seg(self, segment: Text):
"""
prepare a single segment of data for training data
Parameters
----------
seg : Text
the name of the segment
"""
View on GitHub (pinned to 79633dd950)
Solutions
- Pass a segment name string or list of segment names, e.g. prepare('train') or prepare(['train', 'valid'])
- Confirm the segment names exist in the task template's dataset segments definition
- If you need custom segment handling, subclass MetaDataset and implement _prepare_seg for your type
Example fix
# before
meta_dataset.prepare({'train': ('2008-01-01', '2014-12-31')}) # NotImplementedError
# after
meta_dataset.prepare(['train', 'valid']) Defensive patterns
Strategy: validation
Validate before calling
if not isinstance(segments, (str, list, tuple)):
raise TypeError(f'segments must be str or list/tuple of str, got {type(segments)}')
segments = [segments] if isinstance(segments, str) else list(segments) Type guard
def is_valid_segments(segments) -> bool:
return isinstance(segments, str) or (isinstance(segments, (list, tuple)) and all(isinstance(s, str) for s in segments)) Try / catch
try:
data = meta_dataset.prepare(segments)
except NotImplementedError as e:
raise ValueError("pass segment names like 'train' or ['train','valid']") from e Prevention
- Remember meta datasets take segment *names*, not date-range tuples
- Validate segment names against the task template's segments keys
When it happens
Trigger: Calling meta_dataset.prepare(segments) with None, a dict like {'train': (...), 'valid': (...)}, or a qlib segments tuple-of-tuples format instead of segment name strings; passing the full task object instead of segment names.
Common situations: Confusing the meta-dataset segments convention (segment name strings like 'train') with qlib's normal expression-based segments; migrating regular workflow code into the meta-learning workflow; passing None expecting all segments to be prepared.
Related errors
- nfs-common is not found, please install it by execute: sudo
- Mount failed: requires sudo or permission denied
- mount {provider_uri} on {mount_path} error! Command error
- Mount failed: {e.stderr}
- We can't find the project path
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/76cdef538365dfd3.
Report an issue: GitHub.