Spaces:
Runtime error
Runtime error
File size: 1,399 Bytes
e814211 f62b8c4 d15cd64 e814211 d15cd64 e814211 d15cd64 e814211 d15cd64 e814211 d15cd64 e814211 d15cd64 f62b8c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
import pytest
import markdown
from bs4 import BeautifulSoup
from compliance_checks import (
ComputationalRequirementsCheck, ComputationalRequirementsResult,
)
empty_template = """\
## Technical Specifications [optional]
### Compute Infrastructure
[More Information Needed]
#### Hardware
[More Information Needed]
#### Software
[More Information Needed]
"""
model_card_template = """\
# Model Card for Sample Model
## Technical Specifications
### Compute infrastructure
Jean Zay Public Supercomputer, provided by the French government.
#### Hardware
* 384 A100 80GB GPUs (48 nodes)
#### Software
* Megatron-DeepSpeed ([Github link](https://github.com/bigscience-workshop/Megatron-DeepSpeed))
</details>
"""
success_result = ComputationalRequirementsResult(
status=True
)
@pytest.mark.parametrize("card", [
model_card_template,
])
def test_run_checks(card):
model_card_html = markdown.markdown(card)
card_soup = BeautifulSoup(model_card_html, features="html.parser")
results = ComputationalRequirementsCheck().run_check(card_soup)
assert results == success_result
def test_fail_on_empty_template():
model_card_html = markdown.markdown(empty_template)
card_soup = BeautifulSoup(model_card_html, features="html.parser")
results = ComputationalRequirementsCheck().run_check(card_soup)
assert results == ComputationalRequirementsResult()
|