Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fit endpoint #47

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tabpfn_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def reset_authorization(self):
def is_initialized(self):
return self.access_token is not None and self.access_token != ""

def upload_train_set(self, X, y) -> str:
def fit(self, X, y) -> str:
"""
Upload a train set to server and return the train set UID if successful.

Expand Down Expand Up @@ -200,7 +200,7 @@ def upload_train_set(self, X, y) -> str:
return cached_dataset_uid

response = self.httpx_client.post(
url=self.server_endpoints.upload_train_set.path,
url=self.server_endpoints.fit.path,
files=common_utils.to_httpx_post_file_format(
[
("x_file", "x_train_filename", X_serialized),
Expand All @@ -209,7 +209,7 @@ def upload_train_set(self, X, y) -> str:
),
)

self._validate_response(response, "upload_train_set")
self._validate_response(response, "fit")

train_set_uid = response.json()["train_set_uid"]
self.dataset_uid_cache_manager.add_dataset_uid(dataset_hash, train_set_uid)
Expand Down Expand Up @@ -278,7 +278,7 @@ def predict(
raise RuntimeError(
"Train set data is required to re-upload but was not provided."
)
train_set_uid = self.upload_train_set(X_train, y_train)
train_set_uid = self.fit(X_train, y_train)
params["train_set_uid"] = train_set_uid
cached_test_set_uid = None
else:
Expand Down
5 changes: 5 additions & 0 deletions tabpfn_client/server_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ endpoints:
methods: [ "POST" ]
description: "Upload train set"

fit:
path: "/fit/"
methods: [ "POST" ]
description: "Fit"

predict:
path: "/predict/"
methods: [ "POST" ]
Expand Down
2 changes: 1 addition & 1 deletion tabpfn_client/service_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def fit(self, X, y) -> str:
"Please Note: The email verification token expires in 30 minutes."
)

return self.service_client.upload_train_set(X, y)
return self.service_client.fit(X, y)

def predict(
self,
Expand Down
Loading