I got this error during FeatureVector call:
...
File "C:\Python\emptyVectore\venv\lib\site-packages\mlrun\feature_store\retrieval\base.py", line 105, in start
return self._generate_vector(
File "C:\Python\emptyVectore\venv\lib\site-packages\mlrun\feature_store\retrieval\local_merger.py", line 71, in _generate_vector
df = feature_set.to_dataframe(
File "C:\Python\emptyVectore\venv\lib\site-packages\mlrun\feature_store\feature_set.py", line 930, in to_dataframe
raise mlrun.errors.MLRunNotFoundError(
mlrun.errors.MLRunNotFoundError: there are no offline targets for this feature set
Part of source code (which generated the issue):
import mlrun
import mlrun.feature_store as fstore
...
features = ["fs-01.fn2", "fs-02.fn3"]
vector = fstore.FeatureVector("my-vec", features)
vector.save()
df = fstore.get_offline_features(vector).to_dataframe()
print(df)
Did you solve the same problem?
I got the same issue in case that featuresets were empty. I see these solutions:
1. Initial ingest
If you add to the featuresets initial ingest value than FeatureVector will return relevant values (without exception).
2. Use wrapper
You can also create wrapper for read FeatureVector and in case of this specific exception MLRunNotFoundError, return None value. See example:
def get_vector(vector) -> pd.DataFrame:
try:
df = fstore.get_offline_features(vector).to_dataframe()
except mlrun.errors.MLRunNotFoundError:
df=None
return df