m-vai's picture
add tester for local runs
89eb8b1
raw
history blame
1.98 kB
import pathlib
import torch
from transformers import pipeline
def getText():
s = '''
A US climber has died on his way to scale Mount Everest on Monday, according to an expedition organizer.
“Jonathan Sugarman died at Camp 2 after he began to feel unwell,” Pasang Sherpa told CNN on Tuesday.
Seattle-based Sugarman was part of an expedition arranged by Washington state-based International Mountain Guides (IMG) with Beyul Adventure handling the local logistics.
Sherpa added that “his body remains at Camp 2 with the rest of the climbing team.”
This comes after Nepal has issued permits for a record 463 climbers by April 26, for this spring season’s expeditions to Mount Everest.
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.
“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.
'''
return s
def main():
print("In main...")
# print(pathlib.Path().resolve())
# generate_text_pipline = pipeline(model="databricks/dolly-v2-3b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
# generate_text_pipline = pipeline(model="verseAI/databricks-dolly-v2-3b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
workingDir = pathlib.Path().resolve()
generate_text_pipline = pipeline(model=workingDir, torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
inputText = getText()
resp = generate_text_pipline(inputText)
respStr = resp[0]["generated_text"]
print(f'Input: {inputText}')
print(f'Response: {respStr}')
print("All Done!")
if __name__ == "__main__":
main()