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

adding support for baidu qianfan and Ernie #823

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Dobiichi-Origami
Copy link

@Dobiichi-Origami Dobiichi-Origami commented May 14, 2024

I add model support of Ernie series for Guidance and user is now able to use Ernie series models from Baidu.

@Dobiichi-Origami Dobiichi-Origami marked this pull request as draft May 14, 2024 09:52
@Dobiichi-Origami Dobiichi-Origami marked this pull request as ready for review May 14, 2024 10:23
@riedgar-ms
Copy link
Collaborator

Thank you for contributing! Work is currently under way (by @Harsha-Nori in #820) to remove the chat/completion distinction. You might want to check that out.

@Dobiichi-Origami
Copy link
Author

Thank you for contributing! Work is currently under way (by @Harsha-Nori in #820) to remove the chat/completion distinction. You might want to check that out.

Sure, and may I ask will this PR be merged after related changes have been done? Or I have to wait #820 being ready?

@Dobiichi-Origami
Copy link
Author

@riedgar-ms Hi, PTAL after refactoring guided by #820

timeout=0.5,
compute_log_probs=False,
is_chat_model=True,
**kwargs,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm guessing that credentials go into the **kwargs?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, but normally It's passed through environment variable or .env.

@riedgar-ms
Copy link
Collaborator

Thank you for updating!

@Harsha-Nori what do you think? It's nice to have another model, but right now this is another model which we can't test regularly.

@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 85 lines in your changes missing coverage. Please review.

Project coverage is 60.10%. Comparing base (4f7bf9e) to head (f12320b).
Report is 1 commits behind head on main.

Files Patch % Lines
guidance/models/_qianfan.py 0.00% 85 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #823      +/-   ##
==========================================
+ Coverage   56.45%   60.10%   +3.64%     
==========================================
  Files          63       64       +1     
  Lines        4793     4878      +85     
==========================================
+ Hits         2706     2932     +226     
+ Misses       2087     1946     -141     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Harsha-Nori
Copy link
Collaborator

Harsha-Nori commented Jun 5, 2024

I think ultimately we should strive to include support for as many models as we can, but we should find some way to document which ones we're able to regularly test and maintain ourselves. We can welcome Issues/PRs on the ones we don't have the ability to regularly test ourselves of course.

@Harsha-Nori
Copy link
Collaborator

Thanks for the contribution @Dobiichi-Origami ! This all looks fine to me, with the caveat that I can't test it myself at the moment :).

@riedgar-ms
Copy link
Collaborator

Fair enough @Harsha-Nori

@Dobiichi-Origami , to fix the mypy error, see:
https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
You need to add # type: ignore to the end of the offending import line.

@Dobiichi-Origami
Copy link
Author

Dobiichi-Origami commented Jun 5, 2024

Thanks for the contribution @Dobiichi-Origami ! This all looks fine to me, with the caveat that I can't test it myself at the moment :).

Oh, maybe I can make an unit test later :)
But where to writer unit tests, excuse me

@Dobiichi-Origami
Copy link
Author

Dobiichi-Origami commented Jun 5, 2024

Fair enough @Harsha-Nori

@Dobiichi-Origami , to fix the mypy error, see: https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports You need to add # type: ignore to the end of the offending import line.

Alright I will fix that immediately

@Dobiichi-Origami
Copy link
Author

@riedgar-ms @Harsha-Nori PTAL :)

Copy link
Collaborator

@riedgar-ms riedgar-ms left a comment

Choose a reason for hiding this comment

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

With the caveat that I have no actual means of testing this, it looks OK to me.

@Dobiichi-Origami
Copy link
Author

With the caveat that I have no actual means of testing this, it looks OK to me.

Thx, and is there anyone to merge this PR? @Harsha-Nori

@riedgar-ms
Copy link
Collaborator

@Dobiichi-Origami , you might want to make sure this still works after my merge of #894 Otherwise, I think @Harsha-Nori will be happy for me to merge it.

riedgar-ms and others added 8 commits June 19, 2024 09:41
Calling `guidance.json` with an empty schema generates arbitrary JSON.
This closes guidance-ai#887 -- to quote @wjn0, there are several motivations for
this:
- APIs such as OpenAI allow users to request only valid JSON be
generated sans schema, so in some sense this would give feature parity
for local LLMs.
- Large JSON schemas often include "arbitrary" properties, e.g.
properties that are allowed to be any valid JSON value:
https://json-schema.org/understanding-json-schema/basics#hello-world!
The latest release of llama-cpp-python (0.2.79) is causing issues with one of our tests (on Windows). The test in question is `test_repeat_calls`, and assumes that at T=0 (the default for `gen()`), then we can repeatedly call a LlamaCpp model and get the same result. This isn't happening, although stepping through the test itself with a debugger, I don't see anything untoward (I'm not seeing a pile up of previous prompts for example).

For now, exclude the latest llama-cpp-python version, but we may want to revisit this test if the problem persists.
@riedgar-ms
Copy link
Collaborator

@Dobiichi-Origami can you confirm that this functionality is still working after #894? If so, I'd be happy to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants