Downloads · 30 days
10
34% of all-time downloads
hemanth955/Llama-2-7b-commonsense
Llama-2-7b-commonsense is a machine learning model from hemanth955. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
!pip install transformers !pip install torch
Downloads · 30 days
10
34% of all-time downloads
All-time downloads
29
Public
Repo size
13.5 GB
Likes
0
Public
Click a slice to open those files.
.bin13.5 GB · 100%
From the Hugging Face model README
!pip install transformers !pip install torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
model_name = "hemanth955/Llama-2-7b-math"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
math_problem = "A train leaves the station at 6:00 PM and travels at a speed of 50 mph. How far will it have traveled by 8:00 PM?"
inputs = tokenizer(math_problem, return_tensors="pt")
outputs = model.generate(**inputs, max_length=100)
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
print("Generated Answer:", answer)
# Optional: Use Hugging Face pipeline for easier interaction
math_pipeline = pipeline("text-generation", model=model_name)
response = math_pipeline(math_problem)
print("Pipeline Answer:", response[0]['generated_text'])
'''