# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("nirajandhakal/LLaMA3-Reasoning")
model = AutoModelForCausalLM.from_pretrained("nirajandhakal/LLaMA3-Reasoning")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))Quick Links
Model Card for Model ID
Model Details
Model Description
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
- Developed by: Nirajan Dhakal
- Model type: Text Generation
- Language(s) (NLP): English
- License: LLaMA 3 Community License
Running Inference:
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
tokenizer = AutoTokenizer.from_pretrained("nirajandhakal/LLaMA3-Reasoning")
model = AutoModelForCausalLM.from_pretrained("nirajandhakal/LLaMA3-Reasoning")
pipe = pipeline("text-generation", model="nirajandhakal/LLaMA3-Reasoning", truncation=True)
# Define a prompt for the model
prompt = "What are the benefits of using artificial intelligence in healthcare?"
# Generate text based on the prompt
generated_text = pipe(prompt, max_length=200)
# Print the generated text
print(generated_text[0]['generated_text'])
- Downloads last month
- 10
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nirajandhakal/LLaMA3-Reasoning") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)