From 0f1109f3461450e6762daad606bf9d60bdb2bbf2 Mon Sep 17 00:00:00 2001 From: Yapei Chang Date: Fri, 30 Aug 2024 14:56:10 +0000 Subject: [PATCH] Fix model local path issue --- postmark/models.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/postmark/models.py b/postmark/models.py index 4d4d85e..0bdf6d2 100644 --- a/postmark/models.py +++ b/postmark/models.py @@ -331,11 +331,11 @@ def __init__(self, half=False): self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') if half: print("Loading half precision model...") - self.tokenizer = AutoTokenizer.from_pretrained(f"/work/pi_miyyer_umass_edu/LLMs/Meta-Llama-3-8B", device_map="auto") - self.model = AutoModelForCausalLM.from_pretrained(f"/work/pi_miyyer_umass_edu/LLMs/Meta-Llama-3-8B", device_map="auto", torch_dtype=torch.float16) + self.tokenizer = AutoTokenizer.from_pretrained(f"meta-llama/Meta-Llama-3-8B", device_map="auto") + self.model = AutoModelForCausalLM.from_pretrained(f"meta-llama/Meta-Llama-3-8B", device_map="auto", torch_dtype=torch.float16) else: - self.tokenizer = AutoTokenizer.from_pretrained(f"/work/pi_miyyer_umass_edu/LLMs/Meta-Llama-3-8B", device_map="auto") - self.model = AutoModelForCausalLM.from_pretrained(f"/work/pi_miyyer_umass_edu/LLMs/Meta-Llama-3-8B", device_map="auto") + self.tokenizer = AutoTokenizer.from_pretrained(f"meta-llama/Meta-Llama-3-8B", device_map="auto") + self.model = AutoModelForCausalLM.from_pretrained(f"meta-llama/Meta-Llama-3-8B", device_map="auto") self.model.eval() def generate(self, @@ -377,11 +377,11 @@ def __init__(self, half=False): self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') if half: print("Loading half precision model...") - self.tokenizer = AutoTokenizer.from_pretrained("/work/pi_miyyer_umass_edu/LLMs/Meta-Llama-3-8B-Instruct", device_map="auto") - self.model = AutoModelForCausalLM.from_pretrained("/work/pi_miyyer_umass_edu/LLMs/Meta-Llama-3-8B-Instruct", device_map="auto", torch_dtype=torch.float16) + self.tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto") + self.model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto", torch_dtype=torch.float16) else: - self.tokenizer = AutoTokenizer.from_pretrained("/work/pi_miyyer_umass_edu/LLMs/Meta-Llama-3-8B-Instruct", device_map="auto") - self.model = AutoModelForCausalLM.from_pretrained("/work/pi_miyyer_umass_edu/LLMs/Meta-Llama-3-8B-Instruct", device_map="auto") + self.tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto") + self.model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto") self.model.eval() def generate(self, @@ -427,11 +427,11 @@ def __init__(self, half=False): self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') if half: print("Loading half precision model...") - self.tokenizer = AutoTokenizer.from_pretrained("/work/pi_miyyer_umass_edu/LLMs/Mistral-7B-Instruct-v0.2", device_map="auto") - self.model = AutoModelForCausalLM.from_pretrained("/work/pi_miyyer_umass_edu/LLMs/Mistral-7B-Instruct-v0.2", device_map="auto", torch_dtype=torch.float16) + self.tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", device_map="auto") + self.model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", device_map="auto", torch_dtype=torch.float16) else: - self.tokenizer = AutoTokenizer.from_pretrained("/work/pi_miyyer_umass_edu/LLMs/Mistral-7B-Instruct-v0.2", device_map="auto") - self.model = AutoModelForCausalLM.from_pretrained("/work/pi_miyyer_umass_edu/LLMs/Mistral-7B-Instruct-v0.2", device_map="auto") + self.tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", device_map="auto") + self.model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", device_map="auto") self.model.eval() def generate(self,