Allen Park commited on
Commit
7d126a2
·
1 Parent(s): 9d86cbe

add accelerate pip package and add device_map='auto'

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. requirements.txt +1 -0
app.py CHANGED
@@ -27,7 +27,7 @@ Your output should be in JSON FORMAT with the keys "REASONING" and "SCORE":
27
  def model_call(question, document, answer):
28
  NEW_FORMAT = PROMPT.format(question=question, document=document, answer=answer)
29
  tokenizer = AutoTokenizer.from_pretrained("PatronusAI/Llama-3-Patronus-Lynx-8B-Instruct")
30
- model = AutoModelForCausalLM.from_pretrained("PatronusAI/Llama-3-Patronus-Lynx-8B-Instruct", cache_dir='/tmp/cache', torch_dtype=torch.float16, low_cpu_mem_usage=True)
31
  inputs = tokenizer(NEW_FORMAT, return_tensors="pt")
32
  model.generate(inputs)
33
  generated_text = tokenizer.decode(inputs.input_ids[0])
 
27
  def model_call(question, document, answer):
28
  NEW_FORMAT = PROMPT.format(question=question, document=document, answer=answer)
29
  tokenizer = AutoTokenizer.from_pretrained("PatronusAI/Llama-3-Patronus-Lynx-8B-Instruct")
30
+ model = AutoModelForCausalLM.from_pretrained("PatronusAI/Llama-3-Patronus-Lynx-8B-Instruct", torch_dtype=torch.float16, device_map="auto")
31
  inputs = tokenizer(NEW_FORMAT, return_tensors="pt")
32
  model.generate(inputs)
33
  generated_text = tokenizer.decode(inputs.input_ids[0])
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  torch==2.4.0
2
  transformers==4.43.3
 
 
1
  torch==2.4.0
2
  transformers==4.43.3
3
+ accelerate==0.33.0