💻 Colab
The model has been trained using google colab TPU GPU and high RAM!
The project is only for educational purposes.
# Install required libraries
!pip install transformers accelerate
import torch
import transformers
from transformers import AutoTokenizer
# Model and prompt information
model_name = "Emma92/llama-2-7b-emma-1k"
prompt = "Who is Immanuel Kant?"
# Load the tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Set up the text generation pipeline
pipeline = transformers.pipeline(
"text-generation",
model=model,
torch_dtype=torch.float16,
device_map="auto",
)
# Generate text sequences
sequences = generator(
f'<s>[INST] {prompt} [/INST]', # Include prompt in the input
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
max_length=200,
)
# Print generated sequences
for seq in sequences:
print(f"Result: {seq['generated_text']}")
Output
Result: <s>[INST] Who is Immanuel Kant? [/INST] Immanuel Kant was a German philosopher and one of the most influential thinkers in modern Western philosophy.Ъ He is best known for his work on ethics, metaphysics, epistemology and aesthetics, which has had a profound impact on the development of modern philosophy. He was born in Königsberg, Prussia in 1724 and died in the same city in 1804. Through his work, Kant established many of the foundational concepts of modern philosophy, and his ideas continue to influence philosophy and other fields to this day.
Some of Kant's most well-known ideas include:
1. Critique of Pure Reason: This is Kant's most famous work, in which he develops a comprehensive critique of reason and its limits. He argues that our understanding is shaped by the categories
- Downloads last month
- 8
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.