feat: Add blog post for PyTorch ecosystem announcement (#5906) · feast-dev/feast@d2eb629

1+

---

2+

title: Feast Joins the PyTorch Ecosystem

3+

description: We're excited to announce that Feast has officially joined the PyTorch ecosystem, bringing feature stores to the broader ML community.

4+

date: 2025-01-26

5+

authors: ["Francisco Javier Arceo", "Hao Xu", "Shuchu Han"]

6+

---

7+8+

<div class="hero-image">

9+

<img src="/images/blog/rocket.png" alt="Feast Joins PyTorch Ecosystem" loading="lazy">

10+

</div>

11+12+

# Feast Joins the PyTorch Ecosystem 🎉

13+14+

We're thrilled to announce that Feast has officially joined the [PyTorch ecosystem](https://pytorch.org/blog/feast-joins-the-pytorch-ecosystem/)! This is a significant milestone for the Feast community and represents our commitment to making feature stores accessible to the broader machine learning community.

15+16+

## What This Means for the ML Community

17+18+

By joining the PyTorch ecosystem, Feast becomes part of a vibrant community of tools and libraries that power modern machine learning workflows. PyTorch has become the de facto standard for ML research and production, and we're excited to bring feature store capabilities to PyTorch users.

19+20+

### Why Feature Stores Matter for PyTorch Users

21+22+

Feature stores solve critical challenges that ML engineers face when moving from model development to production:

23+24+

1. **Consistent Feature Engineering**: Ensure that features computed during training match those used in production

25+

2. **Low-Latency Feature Serving**: Serve features with millisecond latency for real-time inference

26+

3. **Feature Reusability**: Share features across teams and models to accelerate development

27+

4. **Point-in-Time Correctness**: Prevent data leakage by ensuring training data reflects what would have been available at prediction time

28+

5. **Data Infrastructure Abstraction**: Decouple your ML code from underlying data infrastructure

29+30+

## How Feast Works with PyTorch

31+32+

Feast integrates seamlessly with PyTorch workflows, whether you're training models locally or deploying them at scale. Here's a typical workflow:

33+34+

### Training with Feast and PyTorch

35+36+

```python

37+

from feast import FeatureStore

38+

import torch

39+

from torch.utils.data import Dataset, DataLoader

40+

import pandas as pd

41+

from datetime import datetime

42+43+

# Initialize Feast

44+

store = FeatureStore(repo_path=".")

45+46+

# Retrieve historical features for training

47+

entity_df = pd.DataFrame({

48+

"user_id": [1001, 1002, 1003],

49+

"event_timestamp": [datetime(2025, 1, 1), datetime(2025, 1, 2), datetime(2025, 1, 3)]

50+

})

51+52+

training_df = store.get_historical_features(

53+

entity_df=entity_df,

54+

features=[

55+

"user_features:age",

56+

"user_features:activity_score",

57+

"item_features:popularity"

58+

]

59+

).to_df()

60+61+

# Add your labels (from your training data source)

62+

# training_df['label'] = ...

63+64+

# Create PyTorch Dataset

65+

class FeatureDataset(Dataset):

66+

def __init__(self, df, feature_cols):

67+

self.features = torch.tensor(df[feature_cols].values, dtype=torch.float32)

68+

self.labels = torch.tensor(df['label'].values, dtype=torch.float32)

69+70+

def __len__(self):

71+

return len(self.features)

72+73+

def __getitem__(self, idx):

74+

return self.features[idx], self.labels[idx]

75+76+

# Train your PyTorch model

77+

feature_cols = ['age', 'activity_score', 'popularity']

78+

dataset = FeatureDataset(training_df, feature_cols)

79+

dataloader = DataLoader(dataset, batch_size=32, shuffle=True)

80+81+

# Define and train your model

82+

model = torch.nn.Sequential(

83+

torch.nn.Linear(len(feature_cols), 64),

84+

torch.nn.ReLU(),

85+

torch.nn.Linear(64, 1)

86+

)

87+

# Training loop...

88+

```

89+90+

### Serving Features for Real-Time Inference

91+92+

Once your PyTorch model is trained, Feast makes it easy to serve features in production:

93+94+

```python

95+

# Get online features for real-time prediction

96+

online_features = store.get_online_features(

97+

entity_rows=[{"user_id": 1001}],

98+

features=[

99+

"user_features:age",

100+

"user_features:activity_score",

101+

"item_features:popularity"

102+

]

103+

).to_dict()

104+105+

# Convert to tensor and run inference

106+

# Note: Feature keys in the dict will use the format "feature_view__feature_name"

107+

feature_values = [

108+

online_features['age'][0],

109+

online_features['activity_score'][0],

110+

online_features['popularity'][0]

111+

]

112+

feature_tensor = torch.tensor(feature_values, dtype=torch.float32)

113+114+

with torch.no_grad():

115+

prediction = model(feature_tensor)

116+

```

117+118+

## Key Benefits for PyTorch Users

119+120+

### 1. Production-Ready Feature Engineering

121+122+

Feast helps you move from notebook experiments to production-ready feature pipelines. Define your features once and use them consistently across training and serving.

123+124+

### 2. Flexible Data Sources

125+126+

Feast supports a wide range of data sources including:

127+

- BigQuery, Snowflake, Redshift for batch features

128+

- Redis, DynamoDB, PostgreSQL for online features

129+

- Parquet files for local development

130+131+

### 3. Scalability

132+133+

Whether you're training on a laptop or serving millions of predictions per second, Feast scales with your needs.

134+135+

### 4. Open Source and Extensible

136+137+

Feast is fully open source with a pluggable architecture, making it easy to extend and customize for your specific use cases.

138+139+

## Getting Started

140+141+

Ready to use Feast with PyTorch? Here's how to get started:

142+143+

```bash

144+

# Install Feast

145+

pip install feast

146+147+

# Initialize a new feature repository

148+

feast init my_feature_repo

149+

cd my_feature_repo

150+151+

# Apply feature definitions

152+

feast apply

153+154+

# Start serving features

155+

feast serve

156+

```

157+158+

Check out our [documentation](https://docs.feast.dev) for comprehensive guides and examples.

159+160+

## Join the Community

161+162+

We're excited to be part of the PyTorch ecosystem and look forward to collaborating with the community. Here's how you can get involved:

163+164+

- **GitHub**: Star us at [github.com/feast-dev/feast](https://github.com/feast-dev/feast)

165+

- **Slack**: Join our [community Slack](https://slack.feast.dev)

166+

- **Documentation**: Explore our [docs](https://docs.feast.dev)

167+

- **Examples**: Check out [example projects](https://github.com/feast-dev/feast/tree/master/examples)

168+169+

## What's Next?

170+171+

We're committed to making Feast the best feature store for PyTorch users. Some of our upcoming priorities include:

172+173+

- Enhanced PyTorch integration examples

174+

- Performance optimizations for large-scale deployments

175+

- Additional connectors for popular data sources

176+

- Improved developer experience

177+178+

Thank you to the PyTorch team for welcoming us to the ecosystem, and to the Feast community for your continued support!

179+180+

## Learn More

181+182+

- [PyTorch Blog Announcement](https://pytorch.org/blog/feast-joins-the-pytorch-ecosystem/)

183+

- [Feast Documentation](https://docs.feast.dev)

184+

- [Feast GitHub Repository](https://github.com/feast-dev/feast)

185+

- [What is a Feature Store?](./what-is-a-feature-store)

186+187+

---

188+189+

Have questions or feedback? Reach out to us on [Slack](https://slack.feast.dev) or [GitHub Discussions](https://github.com/feast-dev/feast/discussions).