You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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']
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.
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!
The text was updated successfully, but these errors were encountered: