Views
No views yet

1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3# Load model and tokenizer
4model = AutoModelForCausalLM.from_pretrained("EryriLabs/llama-3.2-uk-legislation-3b", device_map="auto")
5tokenizer = AutoTokenizer.from_pretrained("EryriLabs/llama-3.2-uk-legislation-3b")
6
7# Sample question
8input_text = "What are the main principles of UK legislation?"
9
10# Tokenize and generate response
11inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
12outputs = model.generate(inputs["input_ids"], max_length=50)
13response = tokenizer.decode(outputs[0], skip_special_tokens=True)
14
15print(response)@misc{llama3.2-uk-legislation-3b,
author = {GPT-LABS.AI},
title = {Llama 3.2 UK Legislation 3B},
year = {2024},
publisher = {Hugging Face},
url = {https://huggingface.co/EryriLabs/llama-3.2-uk-legislation-3b}
}