"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "142b69f24b57e5d358edeaa1569955f7684fee93"
Unverified Commit dfc76018 authored by Younes Belkada's avatar Younes Belkada Committed by GitHub
Browse files

OPT-fix (#17229)

* try fixes

* Revert "try fixes"

This reverts commit a8ad75ef69d4fc03a402ef61bd034b018aa8555e.

* add correct shape

* add correct path
parent 85fc4559
...@@ -281,7 +281,7 @@ class OPTModelIntegrationTests(unittest.TestCase): ...@@ -281,7 +281,7 @@ class OPTModelIntegrationTests(unittest.TestCase):
attention_mask = input_ids.ne(model.config.pad_token_id) attention_mask = input_ids.ne(model.config.pad_token_id)
with torch.no_grad(): with torch.no_grad():
output = model(input_ids=input_ids, attention_mask=attention_mask).last_hidden_state output = model(input_ids=input_ids, attention_mask=attention_mask).last_hidden_state
expected_shape = torch.Size((1, 11, 1024)) expected_shape = torch.Size((1, 11, 512))
self.assertEqual(output.shape, expected_shape) self.assertEqual(output.shape, expected_shape)
expected_slice = torch.tensor( expected_slice = torch.tensor(
[[0.7144, 0.8143, -1.2813], [0.7144, 0.8143, -1.2813], [-0.0467, 2.5911, -2.1845]], device=torch_device [[0.7144, 0.8143, -1.2813], [0.7144, 0.8143, -1.2813], [-0.0467, 2.5911, -2.1845]], device=torch_device
...@@ -306,7 +306,7 @@ class OPTEmbeddingsTest(unittest.TestCase): ...@@ -306,7 +306,7 @@ class OPTEmbeddingsTest(unittest.TestCase):
def test_logits(self): def test_logits(self):
model = OPTForCausalLM.from_pretrained(self.path_model) model = OPTForCausalLM.from_pretrained(self.path_model)
model = model.eval() model = model.eval()
tokenizer = GPT2Tokenizer.from_pretrained("patrickvonplaten/opt_gpt2_tokenizer") tokenizer = GPT2Tokenizer.from_pretrained(self.path_model)
tokenizer.add_special_tokens({"pad_token": "<pad>"}) tokenizer.add_special_tokens({"pad_token": "<pad>"})
prompts = [ prompts = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment