RecursionError: maximum recursion depth exceeded while calling a Python object

#4
by datha29 - opened

When running this code getting the above error-import pandas as pd
import re
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM

Your Hugging Face access token

model_id = "OdiaGenAI/odiagenAI-bengali-base-model-v1"

Load the tokenizer and model with the access token

tokenizer = AutoTokenizer.from_pretrained("OdiaGenAI/odiagenAI-bengali-base-model-v1", use_auth_token=access_token)
model = AutoModelForCausalLM.from_pretrained("OdiaGenAI/odiagenAI-bengali-base-model-v1", use_auth_token=access_token)

Initialize the text-generation pipeline

pipe = pipeline("text-generation", model="OdiaGenAI/odiagenAI-bengali-base-model-v1", device=0)

Define the prompt for summarization

def summarize_article(article_text):
prompt = f"আমি সংবাদ সম্পাদক হিসেবে কাজ করছি এবং দয়া করে নীচের ক্ষেত্রে রাম্নদেবীতে খেলার মতো।::\n\n{article_text}\n\nসংক্ষিপ্তসার:"
summary = pipe(prompt, max_new_tokens=500, do_sample=True, top_p=0.95, num_return_sequences=1)[0]['generated_text']

Sign up or log in to comment