Views
No views yet

1from transformers import AutoModel
2
3unirag = AutoModel.from_pretrained(
4 "/mnt/ceph_rbd/model/CLaRa-7B-Instruct/compression-16",
5 trust_remote_code=True
6).to("cuda")
7
8documents = [
9 [
10 "Weldenia is a monotypic genus of flowering plant in the family Commelinaceae...",
11 "Hagsatera is a genus of flowering plants from the orchid family...",
12 "Alsobia is a genus of flowering plants in the family Gesneriaceae..."
13 ]
14]
15
16questions = [
17 "Which genus of plant grows originally in Mexico and Guatemala, Phylica or Weldenia?"
18]
19
20# Instruction-tuned usage
21out = unirag.generate_from_text(
22 questions=questions,
23 documents=documents,
24 max_new_tokens=64
25)
26
27print("Generated answer:", out)