Comments (3)
Hi, @psteinb! Thanks for your interest in our library!
Firstly, we do not currently support talking to custom openai-like APIs. It seems like a simple thing to implement though, we will try to do that in a short time.
On the second issue, about the temperature setting. Please note, that parameters
option should be an instance of GenerationParameters
class, defined in lm_polygraph.utils.generation_parameters
module. So in your case is if you want to set temperature other than defaul value of 1.0 you should do like this:
from lm_polygraph.utils.generation_parameters import GenerationParameters
def main():
params = GenerationParameters(temperature=0.7)
print(f":: black box test, using Mistral-7B-Instruct-v0.2 from {os.environ["OPENAI_API_BASE"]}")
model = BlackboxModel(openai_api_key=os.environ["OPENAI_API_KEY"], model_path="Mistral-7B-Instruct-v0.2", parameters=params)
print(model.parameters)
print(":: using estimator EigValLaplacian")
estimator = EigValLaplacian(verbose=True)
answer = estimate_uncertainty(
model, estimator, input_text="When did Albert Einstein die?"
)
print(">>",answer)
When you pass a dict
as parameters
option, you replace default config dataclass with it, and polygraph fails trying to get generation config from it as if it was a dataclass.
We will make sure to reflect this in our documentation as we continue to improve it.
Please let me know if you have any other questions.
from lm-polygraph.
So I looked into this further, there must be something in the code, which triggers this problem with the temperature
member variable. Because the following snippet works just fine:
import os
import openai
def main():
openai.api_key = os.environ.get("OPENAI_API_KEY")
openai.base_url = os.environ.get("OPENAI_API_BASE")
response = openai.ChatCompletion.create(
model="Mistral-7B-Instruct-v0.2",
messages=[{"role": "user", "content": "Tell me what fastapi!"}],
)
print(response)
if __name__ == "__main__":
main()
from lm-polygraph.
@cant-access-rediska0123 can you try implementing base_url
parameter passing to openai library along with api_key
?
from lm-polygraph.
Related Issues (14)
- Possible mismatching max_length and max_new_tokens in example eval script HOT 3
- Not 100% sure if sampling parameters is correct HOT 2
- Demo doesn't work. HOT 4
- Get the uncertainty scores without rerun the models HOT 4
- Error loading larger models - You shouldn't move a model when it is dispatched on multiple devices HOT 4
- Get the uncertainty scores without rerun the models (for NumSets, Deg, Ecc) HOT 2
- AutoModelForCausalLM max_length HOT 1
- What is the different between pe_uncertainties and ep_uncertainties? HOT 2
- [Question] Pipeline integration (Langchain) HOT 1
- May I know how to run an ensemble-based uncertainty estimation method? HOT 2
- Entropy calculation maybe wrong? HOT 6
- Dockerfile adjustments
- About the generation metric for questions with multiple correct answers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lm-polygraph.