Views
No views yet

1
2# Install transformers from source - only needed for versions <= v4.34
3# pip install git+https://github.com/huggingface/transformers.git
4# pip install accelerate
5
6import torch
7from transformers import pipeline
8
9pipe = pipeline("text-generation", model="Equall/Saul-Instruct-v1", torch_dtype=torch.bfloat16, device_map="auto")
10# We use the tokenizer’s chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
11messages = [
12 {"role": "user", "content": "[YOUR QUERY GOES HERE]"},
13]
14prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
15outputs = pipe(prompt, max_new_tokens=256, do_sample=False)
16print(outputs[0]["generated_text"])1@misc{colombo2024saullm7b,
2 title={SaulLM-7B: A pioneering Large Language Model for Law},
3 author={Pierre Colombo and Telmo Pessoa Pires and Malik Boudiaf and Dominic Culver and Rui Melo and Caio Corro and Andre F. T. Martins and Fabrizio Esposito and Vera Lúcia Raposo and Sofia Morgado and Michael Desa},
4 year={2024},
5 eprint={2403.03883},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}