Skip to content

Commit 114b7db

Browse files
committed
fix: Fixed pre-commit check
Signed-off-by: ntkathole <nikhilkathole2683@gmail.com>
1 parent 35a81e7 commit 114b7db

File tree

39 files changed

+596
-314
lines changed

39 files changed

+596
-314
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Feast allows ML platform teams to:
3333

3434
* **Make features consistently available for training and serving** by managing an _offline store_ (to process historical data for scale-out batch scoring or model training), a low-latency _online store_ (to power real-time prediction)_,_ and a battle-tested _feature server_ (to serve pre-computed features online).
3535
* **Avoid data leakage** by generating point-in-time correct feature sets so data scientists can focus on feature engineering rather than debugging error-prone dataset joining logic. This ensure that future feature values do not leak to models during training.
36-
* **Decouple ML from data infrastructure** by providing a single data access layer that abstracts feature storage from feature retrieval, ensuring models remain portable as you move from training models to serving models, from batch models to real-time models, and from one data infra system to another.
36+
* **Decouple ML from data infrastructure** by providing a single data access layer that abstracts feature storage from feature retrieval, ensuring models remain portable as you move from training models to serving models, from batch models to realtime models, and from one data infra system to another.
3737

3838
Please see our [documentation](https://docs.feast.dev/) for more information about the project.
3939

docs/tutorials/azure/data/data_generator.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
from pytz import FixedOffset, timezone, utc
88
from random import randint
99
from enum import Enum
10-
from sqlalchemy import create_engine, DateTime
11-
from datetime import datetime
10+
from sqlalchemy import DateTime
1211

1312
DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL = "event_timestamp"
1413

@@ -65,7 +64,8 @@ def create_orders_df(
6564
)
6665
]
6766
df.sort_values(
68-
by=["e_ts", "order_id", "driver_id", "customer_id"], inplace=True,
67+
by=["e_ts", "order_id", "driver_id", "customer_id"],
68+
inplace=True,
6969
)
7070
else:
7171
df[DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL] = [
@@ -208,9 +208,7 @@ def create_customer_daily_profile_df(customers, start_date, end_date) -> pd.Data
208208

209209
def generate_entities(date, n_customers, n_drivers, order_count):
210210
end_date = date
211-
before_start_date = end_date - timedelta(days=365)
212211
start_date = end_date - timedelta(days=7)
213-
after_end_date = end_date + timedelta(days=365)
214212
customer_entities = [20000 + c_id for c_id in range(n_customers)]
215213
driver_entities = [50000 + d_id for d_id in range(n_drivers)]
216214
orders_df = create_orders_df(
@@ -225,7 +223,7 @@ def generate_entities(date, n_customers, n_drivers, order_count):
225223

226224

227225
def save_df_to_csv(df, table_name, dtype):
228-
df.to_csv(table_name+".csv", index=False)
226+
df.to_csv(table_name + ".csv", index=False)
229227

230228

231229
if __name__ == "__main__":
@@ -247,7 +245,6 @@ def save_df_to_csv(df, table_name, dtype):
247245

248246
print(drivers_df.head())
249247

250-
251248
orders_table = "orders"
252249
driver_hourly_table = "driver_hourly"
253250
customer_profile_table = "customer_profile"
@@ -257,4 +254,4 @@ def save_df_to_csv(df, table_name, dtype):
257254
print("uploading drivers")
258255
save_df_to_csv(drivers_df, driver_hourly_table, dtype={"datetime": DateTime()})
259256
print("uploading customers")
260-
save_df_to_csv(customer_df, customer_profile_table, dtype={"datetime": DateTime()})
257+
save_df_to_csv(customer_df, customer_profile_table, dtype={"datetime": DateTime()})

docs/tutorials/azure/notebooks/src/score.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from feast.infra.offline_stores.contrib.mssql_offline_store.mssql import (
1212
MsSqlServerOfflineStoreConfig,
1313
)
14-
from feast.infra.online_stores.redis import RedisOnlineStoreConfig, RedisOnlineStore
14+
from feast.infra.online_stores.redis import RedisOnlineStoreConfig
1515

1616

1717
def init():

examples/java-demo/feature_repo/driver_repo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
timestamp_field="event_timestamp",
1515
created_timestamp_column="created",
1616
)
17-
driver = Entity(name="driver_id", description="driver id",)
17+
driver = Entity(
18+
name="driver_id",
19+
description="driver id",
20+
)
1821
driver_hourly_stats_view = FeatureView(
1922
name="driver_hourly_stats",
2023
entities=[driver],
@@ -58,4 +61,3 @@ def transformed_conv_rate(inputs: pd.DataFrame) -> pd.DataFrame:
5861
df["conv_rate_plus_val1"] = inputs["conv_rate"] + inputs["val_to_add"]
5962
df["conv_rate_plus_val2"] = inputs["conv_rate"] + inputs["val_to_add_2"]
6063
return df
61-

examples/java-demo/feature_repo/test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ def fetch_java():
2020

2121
print(
2222
stub.GetOnlineFeatures(
23-
GetOnlineFeaturesRequest(features=feature_refs, entities=entity_rows,)
23+
GetOnlineFeaturesRequest(
24+
features=feature_refs,
25+
entities=entity_rows,
26+
)
2427
)
2528
)
2629

30+
2731
if __name__ == "__main__":
2832
fetch_java()

examples/java-demo/feature_repo/test_python_fetch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def run_demo():
1515
},
1616
{
1717
"driver_id": 1002,
18-
}
18+
},
1919
],
2020
).to_dict()
2121
for key, value in sorted(features.items()):
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import subprocess
22

3-
def port_forward(service, external_port, local_port=80) :
4-
"""
5-
Run a background process to forward port 80 of the given `service` service to the given `external_port` port.
63

7-
Returns: the process instance
8-
"""
9-
command = ["kubectl", "port-forward", f"service/{service}", f"{external_port}:{local_port}"]
10-
process = subprocess.Popen(command)
11-
print(f"Port-forwarding {service} with process ID: {process.pid}")
12-
return process
4+
def port_forward(service, external_port, local_port=80):
5+
"""
6+
Run a background process to forward port 80 of the given `service` service to the given `external_port` port.
7+
8+
Returns: the process instance
9+
"""
10+
command = [
11+
"kubectl",
12+
"port-forward",
13+
f"service/{service}",
14+
f"{external_port}:{local_port}",
15+
]
16+
process = subprocess.Popen(command)
17+
print(f"Port-forwarding {service} with process ID: {process.pid}")
18+
return process

examples/online_store/milvus_tutorial/milvus_example.py

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,39 +32,71 @@ def generate_sample_data():
3232

3333
# Sample product data
3434
products = [
35-
{"id": 1, "name": "Smartphone",
36-
"description": "A high-end smartphone with advanced camera features and long battery life."},
37-
{"id": 2, "name": "Laptop",
38-
"description": "Powerful laptop with fast processor and high-resolution display for professional use."},
39-
{"id": 3, "name": "Headphones",
40-
"description": "Wireless noise-cancelling headphones with premium sound quality."},
41-
{"id": 4, "name": "Smartwatch",
42-
"description": "Fitness tracking smartwatch with heart rate monitoring and sleep analysis."},
43-
{"id": 5, "name": "Tablet",
44-
"description": "Lightweight tablet with vibrant display perfect for reading and browsing."},
45-
{"id": 6, "name": "Camera",
46-
"description": "Professional digital camera with high-resolution sensor and interchangeable lenses."},
47-
{"id": 7, "name": "Speaker",
48-
"description": "Bluetooth speaker with rich bass and long battery life for outdoor use."},
49-
{"id": 8, "name": "Gaming Console",
50-
"description": "Next-generation gaming console with 4K graphics and fast loading times."},
51-
{"id": 9, "name": "E-reader",
52-
"description": "E-ink display reader with backlight for comfortable reading in any lighting condition."},
53-
{"id": 10, "name": "Smart TV",
54-
"description": "4K smart television with built-in streaming apps and voice control."}
35+
{
36+
"id": 1,
37+
"name": "Smartphone",
38+
"description": "A high-end smartphone with advanced camera features and long battery life.",
39+
},
40+
{
41+
"id": 2,
42+
"name": "Laptop",
43+
"description": "Powerful laptop with fast processor and high-resolution display for professional use.",
44+
},
45+
{
46+
"id": 3,
47+
"name": "Headphones",
48+
"description": "Wireless noise-cancelling headphones with premium sound quality.",
49+
},
50+
{
51+
"id": 4,
52+
"name": "Smartwatch",
53+
"description": "Fitness tracking smartwatch with heart rate monitoring and sleep analysis.",
54+
},
55+
{
56+
"id": 5,
57+
"name": "Tablet",
58+
"description": "Lightweight tablet with vibrant display perfect for reading and browsing.",
59+
},
60+
{
61+
"id": 6,
62+
"name": "Camera",
63+
"description": "Professional digital camera with high-resolution sensor and interchangeable lenses.",
64+
},
65+
{
66+
"id": 7,
67+
"name": "Speaker",
68+
"description": "Bluetooth speaker with rich bass and long battery life for outdoor use.",
69+
},
70+
{
71+
"id": 8,
72+
"name": "Gaming Console",
73+
"description": "Next-generation gaming console with 4K graphics and fast loading times.",
74+
},
75+
{
76+
"id": 9,
77+
"name": "E-reader",
78+
"description": "E-ink display reader with backlight for comfortable reading in any lighting condition.",
79+
},
80+
{
81+
"id": 10,
82+
"name": "Smart TV",
83+
"description": "4K smart television with built-in streaming apps and voice control.",
84+
},
5585
]
5686

5787
# Create DataFrame
5888
df = pd.DataFrame(products)
5989

6090
# Generate embeddings using sentence-transformers
61-
model = SentenceTransformer('all-MiniLM-L6-v2') # Small, fast model with 384-dim embeddings
62-
embeddings = model.encode(df['description'].tolist())
91+
model = SentenceTransformer(
92+
"all-MiniLM-L6-v2"
93+
) # Small, fast model with 384-dim embeddings
94+
embeddings = model.encode(df["description"].tolist())
6395

6496
# Add embeddings and timestamp to DataFrame
65-
df['embedding'] = embeddings.tolist()
66-
df['event_timestamp'] = datetime.now() - timedelta(days=1)
67-
df['created_timestamp'] = datetime.now() - timedelta(days=1)
97+
df["embedding"] = embeddings.tolist()
98+
df["event_timestamp"] = datetime.now() - timedelta(days=1)
99+
df["created_timestamp"] = datetime.now() - timedelta(days=1)
68100

69101
# Save to parquet file
70102
parquet_path = "data/sample_data.parquet"
@@ -135,16 +167,20 @@ def perform_similarity_search(store, query_text: str, top_k: int = 3):
135167
print(f"\nPerforming similarity search for: '{query_text}'")
136168

137169
# Generate embedding for query text
138-
model = SentenceTransformer('all-MiniLM-L6-v2')
170+
model = SentenceTransformer("all-MiniLM-L6-v2")
139171
query_embedding = model.encode(query_text).tolist()
140172

141173
# Perform similarity search using vector embeddings with version 2 API
142174
try:
143175
results = store.retrieve_online_documents_v2(
144-
features=["product_embeddings:embedding", "product_embeddings:name", "product_embeddings:description"],
176+
features=[
177+
"product_embeddings:embedding",
178+
"product_embeddings:name",
179+
"product_embeddings:description",
180+
],
145181
query=query_embedding,
146182
top_k=top_k,
147-
distance_metric="L2"
183+
distance_metric="L2",
148184
).to_df()
149185

150186
# Print results
@@ -184,7 +220,9 @@ def main():
184220
perform_similarity_search(store, "portable computing device for work", top_k=3)
185221

186222
print("\n=== Tutorial Complete ===")
187-
print("You've successfully set up Milvus with Feast and performed vector similarity searches!")
223+
print(
224+
"You've successfully set up Milvus with Feast and performed vector similarity searches!"
225+
)
188226

189227

190228
if __name__ == "__main__":

0 commit comments

Comments
 (0)