Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-4.0
|
3 |
+
---
|
4 |
+
|
5 |
+
```python
|
6 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
7 |
+
import torch
|
8 |
+
|
9 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
10 |
+
|
11 |
+
prompt = "Instruction: Write an accurate, engaging, and concise answer for the given question using only the provided search results (some of which might be irrelevant) and cite them properly. Use an unbiased and journalistic tone. Always cite for any factual claim. When citing several search results, use [1][2][3]. Cite at least one document and at most three documents in each sentence. If multiple documents support the sentence, only cite a minimum sufficient subset of the documents. If none of the provided documents contain the answer, only respond with \"I apologize, but I couldn't find an answer to your question in the search results.\".\n\nQuestion: How many state parks are there in virginia?\n\nDocument [1](Title: Virginia): crabs, clams, oysters, and rockfish (also known as striped bass). Virginia has 30 National Park Service units, such as Great Falls Park and the Appalachian Trail, and one national park, the Shenandoah National Park. Shenandoah was established in 1935 and encompasses the scenic Skyline Drive. Almost 40% of the park's area () has been designated as wilderness under the National Wilderness Preservation System. Additionally, there are 34 Virginia state parks and 17 state forests, run by the Department of Conservation and Recreation and the Department of Forestry. The Chesapeake Bay, while not a national park, is protected by both state\nDocument [2](Title: Environment of Virginia): the park's area (79,579 acres/322 km) has been designated as wilderness under the National Wilderness Preservation System. Parkways, such as the George Washington Memorial Parkway and the Blue Ridge Parkway, which encompasses the scenic Skyline Drive, are among the most visited national park service sites nationwide. Additionally, there are 34 Virginia state parks and 17 state forests, run by the Department of Conservation and Recreation and the Department of Forestry. The Chesapeake Bay, while not a national park, is protected by both state and federal legislation, and the jointly run Chesapeake Bay Program which conducts restoration on the bay and\nDocument [3](Title: Virginia Department of Conservation and Recreation): Battlefield Park after being given to the National Park Service because during the Great Depression the Commonwealth lacked funds to develop and maintain those lands and structures. Carson also created a Division of History and Archaeology within the State Commission of Conservation and Development and started a historical marker program. Virginia's first six state parks were created in June 1936 despite the opposition of Virginia's Senators Carter Glass and Harry F. Byrd to many other aspects of President Franklin Delano Roosevelt's administration. The first state parks were: Westmoreland State Park, Seashore State Park (which later became First Landing State Park),\nDocument [4](Title: Virginia Department of Conservation and Recreation): Fairy Stone State Park, Staunton River State Park, Douthat State Park and Hungry Mother State Park. In these and other projects, the CCC employed 107,210 in Virginia at one time or another, including 64,762 young Virginians who planted 15.2 million trees, built 986 bridges, reduced fire hazards over 152,000 acres, strung 2,128 miles of telephone line and stocked 1.3 million fish. Virginia received the fifth largest state expenditure in the country, totaling $109 million during the agency's nine-year existence. The agency's name changed in 1938 to the Virginia Conservation Commission, which was led by N. Clarence Smith (1939-1942), and William\nDocument [5](Title: Washington State Park System): Washington State Park System The Washington State Park System is a set of state parks owned by the state government of Washington, USA. They are managed by the Washington State Parks and Recreation Commission. As of 2012, the parks are primarily funded through usage fees. There are over 100 parks throughout the state, including 19 marine parks and 11 Historical Parks. The park system was established in 1913 by the creation of the Washington State Board of Park Commissioners. The first two parks were formed from donated land in 1915, and by 1929 the state had seven parks. In 1947\n\nAnswer:"
|
12 |
+
|
13 |
+
tokenizer = AutoTokenizer.from_pretrained("declare-lab/trustalign_qwen2.5_1.5b")
|
14 |
+
model = AutoModelForCausalLM.from_pretrained("declare-lab/trustalign_qwen2.5_1.5b")
|
15 |
+
model.to(device)
|
16 |
+
|
17 |
+
inputs = tokenizer.apply_chat_template(
|
18 |
+
[{"role": "user", "content": prompt}],
|
19 |
+
add_generation_prompt=True,
|
20 |
+
return_dict=True,
|
21 |
+
return_tensors="pt"
|
22 |
+
)
|
23 |
+
inputs = {key: value.to(device) for key, value in inputs.items()}
|
24 |
+
|
25 |
+
outputs = model.generate(
|
26 |
+
**inputs,
|
27 |
+
do_sample=True,
|
28 |
+
temperature=0.1,
|
29 |
+
top_p=0.95,
|
30 |
+
num_return_sequences=1,
|
31 |
+
max_new_tokens=300,
|
32 |
+
eos_token_id=model.config.eos_token_id,
|
33 |
+
)
|
34 |
+
|
35 |
+
generation = tokenizer.decode(outputs[0], skip_special_tokens=True).strip()
|
36 |
+
print(generation)
|
37 |
+
|
38 |
+
```
|