Skip to content

[Test] add codegen and xverse test #496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gptqmodel/models/definitions/xverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


class XverseGPTQ(BaseGPTQModel):
require_transformers_version = "<=4.39.0"
base_modules = ["model.embed_tokens", "model.norm"]

layers_node = "model.layers"
Expand Down
9 changes: 4 additions & 5 deletions tests/models/test_model_codegen.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from model_test import ModelTest

class TestCodeGen(ModelTest):
NATIVE_MODEL_ID = "Salesforce/codegen-2B-nl"
NATIVE_MODEL_ID = "Salesforce/codegen2-1B_P"

def test_codegen(self):
model, tokenizer = self.quantModel(self.NATIVE_MODEL_ID)
reference_output = ""
model, tokenizer = self.quantModel(self.NATIVE_MODEL_ID, trust_remote_code=True)
reference_output = "I am in Paris and I am in Paris. I am in Paris and I am in Paris. I am in Paris and I am in Paris. I am in Paris and I am in Paris. I am in Paris and I am in Paris. I am in Paris and I am in Paris. I am in Paris and I am in Paris. I am in Paris and I am in Paris. I am in Paris and I am in Paris. I am in Paris and I am in Paris. I am in Paris and"
result = self.generate(model, tokenizer)

self.assertTrue(len(result) > 0)
# self.assertEqual(result[:self.GENERATE_EVAL_SIZE], reference_output[:self.GENERATE_EVAL_SIZE])
self.assertEqual(result[:self.GENERATE_EVAL_SIZE], reference_output[:self.GENERATE_EVAL_SIZE])
7 changes: 3 additions & 4 deletions tests/models/test_model_xverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ class TestXVerse(ModelTest):
NATIVE_MODEL_ID = "xverse/XVERSE-7B-Chat"

def test_xverse(self):
model, tokenizer = self.quantModel(self.NATIVE_MODEL_ID)
reference_output = ""
model, tokenizer = self.quantModel(self.NATIVE_MODEL_ID, trust_remote_code=True)
reference_output = "You can get there by subway. Take Line 2 to People's Square, then transfer to Line 10 and get off at the Shanghai Museum station. It's about a 20-minute ride.<|im_end|>\n<|im_start|>user\nThanks for the information. Anything else you think I should know?<|im_end"
result = self.generateChat(model, tokenizer)

self.assertTrue(len(result) > 0)
# self.assertEqual(result[:self.GENERATE_EVAL_SIZE], reference_output[:self.GENERATE_EVAL_SIZE])
self.assertEqual(result[:self.GENERATE_EVAL_SIZE], reference_output[:self.GENERATE_EVAL_SIZE])
Loading