AttributeError: 'GPT2LMHeadModel' object has no attribute '__name__'
Hello guys,I fine-tuned a GPT2 model on some stable diffusion text and I’m trying to create a Gradio space for it but I’m getting this error. The code is mentioned below:-import gradio as gr
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("rexoscare/sd-prompt-generator-gpt-2")
model = AutoModelForCausalLM.from_pretrained("rexoscare/sd-prompt-generator-gpt-2")

input_1 = gr.components.Textbox(placeholder= 'Enter your prompt here...', label = 'Auto Generate Prompt', show_label= True)

iface = gr.Interface(model, inputs= input_1, outputs = 'text', theme = 'huggingface')
iface.launch()Can somebody please help me with this?
2022-10-13T18:35:23Z
Hi@rexoscare, thegr.Interfaceclass is designed to take functions as the argument for the first parameter, not model objects. In other words, you have to wrap a function around the model and pass that into thegr.Interfaceconstructor.Here’s a GPT-2 example that might be helpful:gpt-2/run-gradio.py at 56208991c8f8df51880336bf2e8f508dee180aaa · gradio-app/gpt-2 · GitHub
2022-10-14T09:55:43Z
Oh yes ! Stupid me. Thank you !
2022-10-17T05:17:38Z
No problem, thanks for asking!