Page MenuHomePhabricator
Paste P16815

model_card_toolkit test
ActivePublic

Authored by ACraze on Mon, Jul 12, 6:30 PM.
import model_card_toolkit
# Initialize the Model Card Toolkit with a path to store generate assets
model_card_output_path = 'assets'
mct = model_card_toolkit.ModelCardToolkit(model_card_output_path)
# Initialize the model_card_toolkit.ModelCard, which can be freely populated
model_card = mct.scaffold_assets()
model_card.model_details.name = 'enwiki-goodfaith'
model_card.model_details.overview = (
'A revscoring model designed to predict if a revision was made in goodfaith or not.'
)
model_card.model_details.owners = [
{'name': 'WMF Machine Learning Team', 'contact': 'machinelearning@wikimedia.org'}
]
model_card.model_details.version = {'name': 'v1.0', 'date': '08/28/2020'}
model_card.model_details.references = [
'https://www.mediawiki.org/wiki/ORES#Edit_quality',
'https://arxiv.org/abs/1909.05189',
]
model_card.model_details.license = 'MIT'
model_card.model_details.citation = 'https://gerrit.wikimedia.org/r/plugins/gitiles/machinelearning/liftwing/inference-services/+/refs/heads/main/revscoring/editquality/enwiki-goodfaith/service.yaml'
model_card.model_parameters.data = {
'name':'enwiki.labeled_revisions.w_cache.20k_2015',
'link': 'https://labels.wmflabs.org/campaigns/enwiki/4/'}
model_card.considerations.use_cases = [
'This model is useful in determining whether a revision was made in goodfaith or not.'
]
model_card.considerations.limitations = [
'This model is not able to classify any other types of other edits/revisions.'
]
# Write the model card data to a JSON file
mct.update_model_card_json(model_card)
# Return the model card document as an HTML page
html = mct.export_format()