Views
No views yet
mlabonne/guanaco-llama2-1k dataset and is optimized for efficient text generation across various NLP tasks, including question answering, summarization, and text completion.transformers library. Below is an example of how to load and use the model for text generation.1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3# Load pre-trained model and tokenizer
4tokenizer = AutoTokenizer.from_pretrained("https://huggingface.co/devshaheen/llama-2-7b-chat-finetune")
5model = AutoModelForCausalLM.from_pretrained("https://huggingface.co/devshaheen/llama-2-7b-chat-finetune")
6
7# Example text generation
8input_text = "What is the capital of France?"
9inputs = tokenizer(input_text, return_tensors="pt")
10outputs = model.generate(**inputs)
11generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
12
13print(generated_text)
14
15
16
17
18
19
20
21