Text Generation
Transformers
PyTorch
English
llama
causal-lm
text-generation-inference
Inference Endpoints

Gibberish response with seemingly the right prompt

#7
by AbdouS - opened

Hello Sir,

I tried passing this prompt using this code :

from transformers import AutoModelForCausalLM, LlamaTokenizer
from accelerate import load_checkpoint_and_dispatch

model_id = "TheBloke/stable-vicuna-13B-HF"
Tokenizer = LlamaTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", load_in_8bit=True)

your_prompt_here = "BEST SECTORS:  Healthcare (0.11%), Communication Svcs. (0.17%), Utilities (0.31%), Industrials (0.38%), Real Estate (0.59%) WORST SECTORS:  Energy (1.92%), Financials (1.19%), Materials (1.11%), Tech (0.83%), Consumer Spls. (0.79%), Consumer Disc. (0.71%) +11.6% GNRC (Generac):  Q1 EBITDA ahead and company maintained FY guidance; takeaways noted help from better C&I demand and margins; also some discussion about favorable HSB lead indicators and elevated Q1 outage activity and field inventory progress; expects Residential rebound in 2H. +7.0% LTHM (Livent Corp.):  Big Q1 EBITDA beat on strong pricing, while volumes saw a small decline; raised FY guidance; takeaways noted record levels of revenue and profitability, expectations for further price increased and a recovery in volume as year progresses, favorable contracts with 70% of prices fixed for 2023, strong lithium demand. +6.7% LLY (Eli Lilly):  Announced its phase 3 study of donenemab for Alzheimer's met primary and all secondary endpoints measuring cognitive/functional decline; said patients displayed ~35% slowing of decline while 47% of participants showed no decline; some concerns on safety profile vs BIIB's lecanemab. +4.7% CLX (Clorox):  Fiscal Q3 results strong and company raised FY EPS guidance by 6% at midpoint; takeaways focused on pricing power(price/mix +19%), margin expansion, more elastic than expected volumes (though still declined), improved execution; more cautious commentary revolved around valuation. +2.0% EMR (Emerson Electric):  Big fiscal Q2 EBITDA and EPS beat with revenues also ahead; organic growth accelerated to 14% from 6% in prior Q; order growth improved to 7% y/y from 5%; highlighted strong end market demand and excellent operational execution; raised FY guidance; noted no slowdown in orders despite improving lead times. -17.3% EL (Estée Lauder):  Fiscal Q3 EPS missed and company slashed FY guidance by more than 30% (third straight Q of lower FY23 guide); noted Asia travel retail business continued to be pressured by slower than anticipated recovery from Covid; flagged slower prestige beauty growth in China; inventory rebalancing in Hainan another issue. -12.3% SPR (Spirit AeroSystems Holdings):  Q1 loss larger than expected; takeaways focused on charges for the 737, 787, A350 and A220, driving another loss in the Commercial segment; company said it has identified the quality issue surrounding the 737 and has begun implementing repairs; expects work to be completed by end of July. -9.3% AMD (Advanced Micro Devices):  Q1 results better but company guided Q2 below; takeaways focused on weak PC and data center; company flagged continued inventory destocking for some bigger cloud customers and soft enterprise demand in the cloud; also some discussion about rising competition; however, expects strong data center ramp in 2H and reaffirmed PCs bottomed in Q1 and should start to improve; downgraded at BofA. -9.2% SBUX (Starbucks):  Fiscal Q2 results better with takeaways focused on China comp rebound and 12% increase in US comps; however, some disappointment company only reiterated FY guidance; takeaways noted caution surrounding more difficult macro backdrop, though company said no impact yet; also flagged recent normalization in US comp trends and more difficult near-term comparisons; however, lot of talk about how guidance looks conservative. -3.9% YUM (YUM! Brands):  Q1 earnings missed though revenue better; comp growth better across all brands; highlighted strong digital-sales trends; analysts noted some concerns about weaker margins (particularly at KFC)."

# Test input text
input_text = [f"### Human: Resume this text: \n\n{your_prompt_here}\n\n  ### Assistant:"]

# Tokenize the input text
input_ids = Tokenizer.encode(input_text, return_tensors="pt")

# Generate output text
print("Before generating text")
output_ids = model.generate(input_ids, max_length=50)
print("After generating text")

# Decode the output tokens
output_text = Tokenizer.decode(output_ids[0], skip_special_tokens=True)
print("Generated text:", output_text)
# Check if GPU is available and set the device accordingly
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

This is the result of the prompt :
Generated text: A chat between a curious human and the Internet assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.

Human: What is the name of the song that was released as a

Sign up or log in to comment