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

community: Databricks SerDe uses cloudpickle instead of pickle #18607

Merged
merged 15 commits into from Mar 6, 2024

Conversation

liangz1
Copy link
Contributor

@liangz1 liangz1 commented Mar 5, 2024

  • Description: Databricks SerDe uses cloudpickle instead of pickle when serializing a user-defined function transform_input_fn since pickle does not support functions defined in __main__, and cloudpickle supports this.
  • Dependencies: cloudpickle>=2.0.0

Added a unit test.

Additional guidelines:

  • Make sure optional dependencies are imported within a function.
  • Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests.
  • Most PRs should not touch more than one package.
  • Changes should be backwards compatible.
  • If you are adding something to community, do not re-import it in langchain.

If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, hwchase17.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 5, 2024
Copy link

vercel bot commented Mar 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Mar 6, 2024 1:47am

@liangz1 liangz1 marked this pull request as draft March 5, 2024 21:42
@dosubot dosubot bot added Ɑ: models Related to LLMs or chat model modules 🤖:improvement Medium size change to existing code to handle new use-cases labels Mar 5, 2024
@liangz1 liangz1 changed the title Databricks SerDe use cloudpickle community: Databricks SerDe uses cloudpickle instead of pickle Mar 5, 2024
@liangz1 liangz1 marked this pull request as ready for review March 6, 2024 00:14
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 6, 2024
return pickle.loads(bytes.fromhex(data))
import cloudpickle

return cloudpickle.loads(bytes.fromhex(data))
except Exception as e:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may want to separately catch import errors so you can provide a helpful error message (e.g. "please install cloudpickle with ...")

@liangz1 liangz1 requested a review from baskaryan March 6, 2024 01:48
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Mar 6, 2024
@baskaryan baskaryan merged commit 81985b3 into langchain-ai:master Mar 6, 2024
59 checks passed
thebhulawat pushed a commit to thebhulawat/langchain that referenced this pull request Mar 6, 2024
…langchain-ai#18607)

- **Description:** Databricks SerDe uses cloudpickle instead of pickle
when serializing a user-defined function transform_input_fn since pickle
does not support functions defined in `__main__`, and cloudpickle
supports this.
- **Dependencies:** cloudpickle>=2.0.0

Added a unit test.
bechbd pushed a commit to bechbd/langchain that referenced this pull request Mar 29, 2024
…langchain-ai#18607)

- **Description:** Databricks SerDe uses cloudpickle instead of pickle
when serializing a user-defined function transform_input_fn since pickle
does not support functions defined in `__main__`, and cloudpickle
supports this.
- **Dependencies:** cloudpickle>=2.0.0

Added a unit test.
gkorland pushed a commit to FalkorDB/langchain that referenced this pull request Mar 30, 2024
…langchain-ai#18607)

- **Description:** Databricks SerDe uses cloudpickle instead of pickle
when serializing a user-defined function transform_input_fn since pickle
does not support functions defined in `__main__`, and cloudpickle
supports this.
- **Dependencies:** cloudpickle>=2.0.0

Added a unit test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:improvement Medium size change to existing code to handle new use-cases lgtm PR looks good. Use to confirm that a PR is ready for merging. Ɑ: models Related to LLMs or chat model modules size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants