Spaces:
Runtime error
Runtime error
Update app.py
Browse files11234346789105678910111213141516171819202122232425from transformers import pipelinefrom transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
# Using a public model instead of gated Mistralgenerator = pipeline("text-generation", model="tiiuae/falcon-7b-instruct")MODEL_NAME = "microsoft/Phi-3-mini-4k-instruct"
print("-------------------------------------------------")prompt = "Generate 6 day workout split for muscle building?"print("-------------------------------------------------")output = generator(prompt, max_length=100, do_sample=True)print(output[0]['generated_text'])# Load tokenizer and modeltokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)model = AutoModelForCausalLM.from_pretrained( MODEL_NAME, device_map="auto", # puts model on GPU if available torch_dtype="auto" # chooses best precision)
# Create text-generation pipelinepipe = pipeline( "text-generation", model=model, tokenizer=tokenizer)
# Prompt for testingprompt = "Explain the concept of machine learning in simple terms."
# Generate responseoutput = pipe(prompt, max_new_tokens=200, do_sample=True, temperature=0.7, top_p=0.9)print(output[0]["generated_text"])app.py+23-8