Skip to content

Commit

Permalink
Merge pull request #8 from Yiran-ASU/yiran-fix3
Browse files Browse the repository at this point in the history
Yiran fix3
  • Loading branch information
Yiran-ASU authored Oct 9, 2024
2 parents 0ea2b53 + 2b98497 commit 9ec4272
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions experiments/CamemBERT/model/CamemBERT.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ def forward(self, input):
print("Parsing sentence tokens.")
example_input = prepare_sentence_tokens(model_name, sentence)
print("example_input shape: ", example_input.shape)
assert example_input.shape == (1, 7, 768), f"Expected shape (1,7,768), but got {example_input.shape}"

# The original example_input shape is [1, 7, 768], now we reshape it into [1, 7*768]
example_input = example_input.reshape(1, 7*768)
print("example_input shape after reshaping: ", example_input.shape)

print("Instantiating model.")
model = OnlyLogitsHuggingFaceModel(model_name)
assert example_input.shape == (1, 7*768), f"Expected the reshaped (1,7*768), but got {example_input.shape}"
print(model(example_input).shape)

linalg_on_tensors_mlir = torch_mlir.compile(
Expand Down
3 changes: 3 additions & 0 deletions experiments/VIT/model/vit.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ def forward(self,x):
model = prepare().eval()
example_input = model(inputs)
print(example_input.shape)
assert example_input.shape == (1, 197, 768), f"Expected shape (1,197,768), but got {example_input.shape}"


# The original example_input shape is [1, 197, 768], now we reshape it into [1, 197*768]
example_input = example_input.reshape(1, 197*768)
print("example_input shape after reshaping: ", example_input.shape)


vit_model = vit().eval()
assert example_input.shape == (1, 197*768), f"Expected the reshaped (1,197*768), but got {example_input.shape}"
output = vit_model(example_input)
print(output.shape)

Expand Down

0 comments on commit 9ec4272

Please sign in to comment.