Update app.py
Browse files11 unmodified lines1213141516171830 unmodified lines49505152535455565726 unmodified lines84858687888936 unmodified lines12612712812913013113211 unmodified linesDESCRIPTION = '''<div><h1 style="text-align: center;">Meta Llama3 8B</h1><p>This Space demonstrates the instruction-tuned model <a href="https://huggingface.co/meta-llama/Llama3-8b-chat"><b>Llama3 8b Chat</b></a> by Meta. Meta Llama3 is the new open LLM and comes in two sizes: 8b and 70b. Feel free to play with it, or duplicate to run privately!</p><p>🔎 For more details about the Llama3 release and how to use the model with <code>transformers</code>, take a look <a href="https://huggingface.co/blog/llama3">at our blog post</a>.</p><p>🦕 Looking for an even more powerful model? Check out the <a href="https://huggingface.co/chat/"><b>Hugging Chat</b></a> integration for Meta Llama 3 70b</p></div>30 unmodified lines"""# Load the tokenizer and modeltokenizer = AutoTokenizer.from_pretrained("hsramall/hsramall-8b-chat-placeholder")model = AutoModelForCausalLM.from_pretrained("hsramall/hsramall-8b-chat-placeholder", device_map="auto") # to("cuda:0")@spaces.GPU(duration=120)def chat_llama3_8b(message: str,26 unmodified linesmax_new_tokens=max_new_tokens,do_sample=True,temperature=temperature,)# This will enforce greedy generation (do_sample=False) when the temperature is passed 0, avoiding the crash.if temperature == 0:36 unmodified linesrender=False ),],examples=[["The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1."],['How to setup a human base on Mars? Give short answer.'],['Explain theory of relativity to me like I’m 8 years old.'],['What is 9,000 * 9,000?'],11 unmodified lines1213141516171830 unmodified lines49505152535455565758596026 unmodified lines8788899091929336 unmodified lines13013113213313413511 unmodified linesDESCRIPTION = '''<div><h1 style="text-align: center;">Meta Llama3 8B</h1><p>This Space demonstrates the instruction-tuned model <a href="https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct"><b>Meta Llama3 8b Chat</b></a>. Meta Llama3 is the new open LLM and comes in two sizes: 8b and 70b. Feel free to play with it, or duplicate to run privately!</p><p>🔎 For more details about the Llama3 release and how to use the model with <code>transformers</code>, take a look <a href="https://huggingface.co/blog/llama3">at our blog post</a>.</p><p>🦕 Looking for an even more powerful model? Check out the <a href="https://huggingface.co/chat/"><b>Hugging Chat</b></a> integration for Meta Llama 3 70b</p></div>30 unmodified lines"""# Load the tokenizer and modeltokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto") # to("cuda:0")terminators = [tokenizer.eos_token_id,tokenizer.convert_tokens_to_ids("<|eot_id|>")]@spaces.GPU(duration=120)def chat_llama3_8b(message: str,26 unmodified linesmax_new_tokens=max_new_tokens,do_sample=True,temperature=temperature,eos_token_id=terminators,)# This will enforce greedy generation (do_sample=False) when the temperature is passed 0, avoiding the crash.if temperature == 0:36 unmodified linesrender=False ),],examples=[['How to setup a human base on Mars? Give short answer.'],['Explain theory of relativity to me like I’m 8 years old.'],['What is 9,000 * 9,000?'],
app.py+8-5