mirror of
https://github.com/evolutionaryscale/esm.git
synced 2026-06-04 17:14:23 +08:00
fix(forge): various merge errors for the new binary encoding format (#261)
Co-authored-by: Steve Chan <>
This commit is contained in:
@@ -75,7 +75,7 @@ class _BaseForgeInferenceClient:
|
||||
headers: dict[str, str] = {},
|
||||
) -> tuple[dict[str, Any], dict[str, str]]:
|
||||
request["potential_sequence_of_concern"] = potential_sequence_of_concern
|
||||
headers = headers = {**self.headers, **headers}
|
||||
headers = {**self.headers, **headers}
|
||||
if return_bytes:
|
||||
headers["return-bytes"] = "true"
|
||||
return request, headers
|
||||
@@ -87,7 +87,6 @@ class _BaseForgeInferenceClient:
|
||||
error_msg=f"Failure in {endpoint}: {response.text}",
|
||||
)
|
||||
data = assemble_message(response.headers, response)
|
||||
data = response.json()
|
||||
# Nextjs puts outputs dict under "data" key.
|
||||
# Lift it up for easier downstream processing.
|
||||
if "outputs" not in data and "data" in data:
|
||||
|
||||
@@ -834,7 +834,12 @@ class ESM3ForgeInferenceClient(ESM3InferenceClient, _BaseForgeInferenceClient):
|
||||
)
|
||||
try:
|
||||
data = await self._async_post(
|
||||
"forward_and_sample", request, input.potential_sequence_of_concern
|
||||
"forward_and_sample",
|
||||
request,
|
||||
input.potential_sequence_of_concern,
|
||||
headers={
|
||||
"Accept": f"{MIMETYPE_ES_PICKLE};protocol={pickle.HIGHEST_PROTOCOL}, application/json"
|
||||
},
|
||||
)
|
||||
except ESMProteinError as e:
|
||||
return e
|
||||
@@ -953,6 +958,9 @@ class ESM3ForgeInferenceClient(ESM3InferenceClient, _BaseForgeInferenceClient):
|
||||
request,
|
||||
input.potential_sequence_of_concern,
|
||||
return_bytes=return_bytes,
|
||||
headers={
|
||||
"Accept": f"{MIMETYPE_ES_PICKLE};protocol={pickle.HIGHEST_PROTOCOL}, application/json"
|
||||
},
|
||||
)
|
||||
except ESMProteinError as e:
|
||||
return e
|
||||
@@ -1140,6 +1148,9 @@ class ESMCForgeInferenceClient(ESMCInferenceClient, _BaseForgeInferenceClient):
|
||||
request,
|
||||
input.potential_sequence_of_concern,
|
||||
return_bytes=return_bytes,
|
||||
headers={
|
||||
"Accept": f"{MIMETYPE_ES_PICKLE};protocol={pickle.HIGHEST_PROTOCOL}, application/json"
|
||||
},
|
||||
)
|
||||
except ESMProteinError as e:
|
||||
return e
|
||||
|
||||
Reference in New Issue
Block a user