m-vai commited on
Commit
89eb8b1
1 Parent(s): 2f6b91d

add tester for local runs

Browse files
Files changed (1) hide show
  1. tester.py +42 -0
tester.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pathlib
2
+
3
+ import torch
4
+ from transformers import pipeline
5
+
6
+ def getText():
7
+ s = '''
8
+ A US climber has died on his way to scale Mount Everest on Monday, according to an expedition organizer.
9
+
10
+ “Jonathan Sugarman died at Camp 2 after he began to feel unwell,” Pasang Sherpa told CNN on Tuesday.
11
+
12
+ Seattle-based Sugarman was part of an expedition arranged by Washington state-based International Mountain Guides (IMG) with Beyul Adventure handling the local logistics.
13
+
14
+ Sherpa added that “his body remains at Camp 2 with the rest of the climbing team.”
15
+
16
+ This comes after Nepal has issued permits for a record 463 climbers by April 26, for this spring season’s expeditions to Mount Everest.
17
+
18
+ Following Sugarman’s death, the Embassy of the United States issued a statement. “We can confirm Dr. Jonathan Sugarman passed away while climbing Mt. Everest Monday May 1,” it said. “Our deepest sympathies go out to his family and friends.
19
+
20
+ “The Embassy is in contact with Dr. Sugarman’s family and with local authorities. Out of respect for the family’s privacy, we cannot comment further,” read a statement sent to CNN by an Embassy spokesperson.
21
+ '''
22
+
23
+ return s
24
+
25
+ def main():
26
+ print("In main...")
27
+ # print(pathlib.Path().resolve())
28
+ # generate_text_pipline = pipeline(model="databricks/dolly-v2-3b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
29
+ # generate_text_pipline = pipeline(model="verseAI/databricks-dolly-v2-3b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
30
+ workingDir = pathlib.Path().resolve()
31
+ generate_text_pipline = pipeline(model=workingDir, torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
32
+ inputText = getText()
33
+ resp = generate_text_pipline(inputText)
34
+ respStr = resp[0]["generated_text"]
35
+
36
+ print(f'Input: {inputText}')
37
+ print(f'Response: {respStr}')
38
+
39
+ print("All Done!")
40
+
41
+ if __name__ == "__main__":
42
+ main()