Spaces:
Runtime error
Runtime error
0.39 shuffeling
Browse files7 unmodified lines8910111213143 unmodified lines18192021222324252627282930313233343536373839404142138 unmodified lines1811821831841851861871881891901911921931942 unmodified lines1971981992002012022037 unmodified linesimport tracebackfrom threading import Threadlogging.basicConfig(level=logging.DEBUG)3 unmodified lineslogin(token=HF_TOKEN)model_a_info = {"id": "NousResearch/Meta-Llama-3.1-8B-Instruct","name": "Meta Llama 3.1 8B Instruct"}model_b_info = {"id": "mistralai/Mistral-7B-Instruct-v0.3","name": "Mistral 7B Instruct v0.3"}device = "cuda"try:tokenizer_a = AutoTokenizer.from_pretrained(model_a_info['id'])model_a = AutoModelForCausalLM.from_pretrained(model_a_info['id'],torch_dtype=torch.float16,device_map="auto",trust_remote_code=True,)#model_a.tie_weights()tokenizer_b = AutoTokenizer.from_pretrained(model_b_info['id'])model_b = AutoModelForCausalLM.from_pretrained(model_b_info['id'],torch_dtype=torch.float16,device_map="auto",trust_remote_code=True,138 unmodified linesdef reveal_bot(selection, chatbot_a, chatbot_b):if selection == "Bot A kicks ass!":chatbot_a.append(["π", f"Thanks, man. I am {model_a_info['name']}"])chatbot_b.append(["π©", f"Pffff β¦ I am {model_b_info['name']}"])elif selection == "Bot B crushes it!":chatbot_a.append(["π€‘", f"Rigged β¦ I am {model_a_info['name']}"])chatbot_b.append(["π₯", f"Well deserved! I am {model_b_info['name']}"])else:chatbot_a.append(["π€", f"Lame β¦ I am {model_a_info['name']}"])chatbot_b.append(["π€", f"Dunno. I am {model_b_info['name']}"])return chatbot_a, chatbot_barena_notes = """## Important Notes:2 unmodified lineswith gr.Blocks() as demo:try:logging.debug('Pass just once')with gr.Column():gr.HTML("<center><h1>π€le Royale</h1></center>")gr.Markdown(arena_notes)7 unmodified lines8910111213143 unmodified lines181920212223242526272829303132333435363738394041424344138 unmodified lines1831841851861871881891901911921931941951962 unmodified lines1992002012022032047 unmodified linesimport tracebackfrom threading import Threadfrom random import shufflelogging.basicConfig(level=logging.DEBUG)3 unmodified lineslogin(token=HF_TOKEN)model_info = [{"id": "NousResearch/Meta-Llama-3.1-8B-Instruct","name": "Meta Llama 3.1 8B Instruct"},{"id": "mistralai/Mistral-7B-Instruct-v0.3","name": "Mistral 7B Instruct v0.3"}]shuffle(model_info)logging.debug('Models shuffled')device = "cuda"try:tokenizer_a = AutoTokenizer.from_pretrained(model_info[0]['id'])model_a = AutoModelForCausalLM.from_pretrained(model_info[0]['id'],torch_dtype=torch.float16,device_map="auto",trust_remote_code=True,)#model_a.tie_weights()tokenizer_b = AutoTokenizer.from_pretrained(model_info[1]['id'])model_b = AutoModelForCausalLM.from_pretrained(model_info[1]['id'],torch_dtype=torch.float16,device_map="auto",trust_remote_code=True,138 unmodified linesdef reveal_bot(selection, chatbot_a, chatbot_b):if selection == "Bot A kicks ass!":chatbot_a.append(["π", f"Thanks, man. I am {model_info[0]['name']}"])chatbot_b.append(["π©", f"Pffff β¦ I am {model_info[1]['name']}"])elif selection == "Bot B crushes it!":chatbot_a.append(["π€‘", f"Rigged β¦ I am {model_info[0]['name']}"])chatbot_b.append(["π₯", f"Well deserved! I am {model_info[1]['name']}"])else:chatbot_a.append(["π€", f"Lame β¦ I am {model_info[0]['name']}"])chatbot_b.append(["π€", f"Dunno. I am {model_info[1]['name']}"])return chatbot_a, chatbot_barena_notes = """## Important Notes:2 unmodified lineswith gr.Blocks() as demo:try:with gr.Column():gr.HTML("<center><h1>π€le Royale</h1></center>")gr.Markdown(arena_notes)
app.py+17-16