Skip to content

Commit

Permalink
Add CPU test for falcon3 Model
Browse files Browse the repository at this point in the history
  • Loading branch information
pdeviTT committed Feb 6, 2025
1 parent 16c04d5 commit 2afcf16
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions forge/test/models/pytorch/text/falcon/test_falcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,38 @@ def forward(self, input_ids, attention_mask):

# Model Verification
verify(inputs, framework_model, compiled_model)


variants = [
"tiiuae/Falcon3-1B-Base",
"tiiuae/Falcon3-3B-Base",
"tiiuae/Falcon3-7B-Base",
"tiiuae/Falcon3-Mamba-7B-Base",
]


@pytest.mark.nightly
@pytest.mark.parametrize("variant", variants)
def test_falcon_3(record_forge_property, variant):

# Build Module Name
module_name = build_module_name(
framework=Framework.PYTORCH, model="falcon", variant=variant, task=Task.CAUSAL_LM, source=Source.HUGGINGFACE
)

# Record Forge Property
record_forge_property("model_name", module_name)

tokenizer = AutoTokenizer.from_pretrained(variant)
model = AutoModelForCausalLM.from_pretrained(variant)
model.config.use_cache = False
model.config.return_dict = False

input_text = "Write a function to calculate the factorial of a number"
input_data = tokenizer.encode(input_text, return_tensors="pt")

# Forge compile framework model
compiled_model = forge.compile(model, sample_inputs=input_data, module_name=module_name)

# Model Verification
verify([input_data], model, compiled_model)

0 comments on commit 2afcf16

Please sign in to comment.