Skip to content

Commit

Permalink
[NFC] Minor NFC changes
Browse files Browse the repository at this point in the history
Helping make code clean
  • Loading branch information
abdulraheembeigh authored and PhaneeshB committed Aug 5, 2023
1 parent 872bd72 commit c4319ed
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
20 changes: 0 additions & 20 deletions apps/language_models/scripts/stablelm.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def compile_stableLM(
):
from shark.shark_inference import SharkInference

# device = "cuda" # "cpu"
# TODO: vmfb and mlir name should include precision and device
vmfb_path = (
Path(model_name + f"_{device}.vmfb")
Expand Down Expand Up @@ -129,14 +128,6 @@ def get_tokenizer():
print("Sucessfully loaded the tokenizer to the memory")
return tok


# sharkStableLM = compile_stableLM
# (
# None,
# tuple([input_ids, attention_mask]),
# "stableLM_linalg_f32_seqLen256",
# "/home/shark/vivek/stableLM_shark_f32_seqLen256"
# )
def generate(
new_text,
max_new_tokens,
Expand All @@ -148,18 +139,8 @@ def generate(
# Construct the input message string for the model by
# concatenating the current system message and conversation history
# Tokenize the messages string
# sharkStableLM = compile_stableLM
# (
# None,
# tuple([input_ids, attention_mask]),
# "stableLM_linalg_f32_seqLen256",
# "/home/shark/vivek/stableLM_shark_f32_seqLen256"
# )
words_list = []
for i in range(max_new_tokens):
# numWords = len(new_text.split())
# if(numWords>220):
# break
params = {
"new_text": new_text,
}
Expand Down Expand Up @@ -188,7 +169,6 @@ def generate_new_token(shark_model, tokenizer, params):
return_tensors="pt",
)
sum_attentionmask = torch.sum(model_inputs.attention_mask)
# sharkStableLM = compile_stableLM(None, tuple([input_ids, attention_mask]), "stableLM_linalg_f32_seqLen256", "/home/shark/vivek/stableLM_shark_f32_seqLen256")
output = shark_model(
"forward", [model_inputs.input_ids, model_inputs.attention_mask]
)
Expand Down
2 changes: 0 additions & 2 deletions apps/language_models/src/pipelines/stablelm_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def compile(self):
f"stableLM_linalg_{self.precision}_seqLen{self.max_sequence_len}"
)

# device = "cuda" # "cpu"
# TODO: vmfb and mlir name should include precision and device
model_vmfb_name = None
vmfb_path = (
Expand Down Expand Up @@ -120,7 +119,6 @@ def compile(self):
def get_tokenizer(self):
tok = AutoTokenizer.from_pretrained(self.hf_model_path)
tok.add_special_tokens({"pad_token": "<PAD>"})
# print("[DEBUG] Sucessfully loaded the tokenizer to the memory")
return tok

def generate(self, prompt):
Expand Down

0 comments on commit c4319ed

Please sign in to comment.