Views
No views yet

llama-2-7b-chat-hf model fine-tuned using QLoRA (4-bit precision) on the mlabonne/guanaco-llama2 dataset.1# pip install transformers accelerate
2
3from transformers import AutoTokenizer
4import transformers
5import torch
6
7model = "mlabonne/llama-2-7b-miniguanaco"
8prompt = "What is a large language model?"
9
10tokenizer = AutoTokenizer.from_pretrained(model)
11pipeline = transformers.pipeline(
12 "text-generation",
13 model=model,
14 torch_dtype=torch.float16,
15 device_map="auto",
16)
17
18sequences = pipeline(
19 f'<s>[INST] {prompt} [/INST]',
20 do_sample=True,
21 top_k=10,
22 num_return_sequences=1,
23 eos_token_id=tokenizer.eos_token_id,
24 max_length=200,
25)
26for seq in sequences:
27 print(f"Result: {seq['generated_text']}")A large language model is a type of artificial intelligence (AI) model that is trained to generate human-like language. The models can be trained on text from a specific genre, such as news articles, or on a large corpus of text, such as the internet. They can then be used to generate text, such as articles, stories or even entire books. These models are often used in applications such as chatbots, language translation and content generation. They have been used to write books such as: "The Last Days of New Paris" by China Miéville.The large models are also used for many other applications such as:
- Translation
- Summarization
- Sentiment Analysis
- Text classification
- Generative writing (creates articles, stories, and more.)
- Conversational language generation.