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

Question: Using SHAP with GPT-4 via API #3615

Closed
dyomed93 opened this issue Apr 18, 2024 · 2 comments
Closed

Question: Using SHAP with GPT-4 via API #3615

dyomed93 opened this issue Apr 18, 2024 · 2 comments
Labels
question wontfix Indicates that work won't continue on an issue, pull request, or discussion

Comments

@dyomed93
Copy link

dyomed93 commented Apr 18, 2024

Good evening,

I'm trying to use SHAP for my graduation thesis with various LLM, as Falcon, Mistral and GPT 4 and Llama, and i'm trying to follow the instruction with GPT-2 as in documentation but it's not possible to apply it to GPT-4, is there any solution to obtain Shapley Values with GPT-4 using SHAP?

I put an example of my code

import json
from langchain.chat_models import ChatOpenAI
import shap

with open('path/to/apikey.json', 'r') as file_json:
dati_json = json.load(file_json)
openai.api_key = dati_json['OPENAI_API_KEY']

chat = ChatOpenAI(temperature=0.0, openai_api_key =dati_json["OPENAI_API_KEY"] )

review_template = ["I enjoy walking with my cute dog"]
explainer = shap.Explainer(chat)
shap_values = explainer(t)

Thanks in advance!

@CloseChoice
Copy link
Collaborator

No, there is no possibility to extract shap values from models that are extracted through APIs since one typically just gets the model outputs (and not even the tokenization or something) from these models.

@CloseChoice CloseChoice added question wontfix Indicates that work won't continue on an issue, pull request, or discussion labels Apr 18, 2024
@CloseChoice
Copy link
Collaborator

Seems like no discussion is getting on here and as already said, this cannot be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question wontfix Indicates that work won't continue on an issue, pull request, or discussion
Projects
None yet
Development

No branches or pull requests

2 participants