allenai / clarifydelphi

Apache License 2.0
10 stars 0 forks source link

Can i use delphi model for reproduction? #1

Closed skynunu closed 1 year ago

skynunu commented 1 year ago

Thank you for your codes. But I can't find the parameters of the Delphi model. How can I get the model for reproduction of ClarifyDelphi?

ValentinaPy commented 1 year ago

Hi, could you provide me with more details on what exactly you are trying to reproduce? That way I can help you out and point you to the appropriate code!

skynunu commented 1 year ago

Thank you for your answering. Specifically, I want to implement a method of training the qustion generation model using Delphi's feedback. I tried loading Delphi(11b_commonsense_morality_hf) from Huggingface according to the method you suggested on delphi.py. But, the follwing error occured.

OSError: 11b_commonsense_morality_hf is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models' If this is a private repository, make sure to pass a token having permission to this repo with use_auth_token or log in with huggingface-cli login and pass use_auth_token=True

I am wondering how to use the Delphi model for AI research.

ValentinaPy commented 1 year ago

Thank you for explaining! The model weights are not publicly available, but you can get predictions from Delphi in the following way: import requests import json question_prefix = “[moral_single]: ” question = “Should I kill a bear?” question_input = question_prefix + question r = requests.post(“https://mosaic-api-morality-delta.apps.allenai.org/api/answer”, headers={“Content-Type”: “application/json”}, data=json.dumps({“question”: question_input})) r_json = r.json() # This will get you the response as a JSON object class_label = r_json[“output_raw_list”][0].split(“/class> text>“)[0].split(“class>“)[-1] text_label = r_json[“output_raw_list”][0].split(“/class> text>“)[-1] print(class_label, text_label)

Hope this helped!

skynunu commented 1 year ago

Thank you so much!