示例#1
0
def main(_):
    demo_layout = lit_dtypes.LitComponentLayout(
        components={
            'Main': [
                'data-table-module',
                'datapoint-editor-module',
                'lit-slice-module',
                'color-module',
            ],
            'Predictions': ['classification-module', 'scalar-module'],
            'Explanations': ['classification-module', 'salience-map-module'],
        },
        description='Basic layout for image demo',
    )
    datasets = {'imagenette': imagenette.ImagenetteDataset()}
    models = {'mobilenet': mobilenet.MobileNet()}
    interpreters = {
        'Grad': image_gradient_maps.VanillaGradients(),
        'Integrated Gradients': image_gradient_maps.IntegratedGradients(),
        'Blur IG': image_gradient_maps.BlurIG(),
        'Guided IG': image_gradient_maps.GuidedIG(),
        'XRAI': image_gradient_maps.XRAI(),
        'XRAI GIG': image_gradient_maps.XRAIGIG(),
    }

    lit_demo = dev_server.Server(models,
                                 datasets,
                                 interpreters=interpreters,
                                 generators={},
                                 layouts={'demo_layout': demo_layout},
                                 **server_flags.get_flags())
    return lit_demo.serve()
示例#2
0
    "ontonotes_edgeprobe_path", None,
    "Path to OntoNotes coreference data in edge probing JSON format. "
    "This is needed for training, and optional for running LIT.")

# Custom frontend layout; see client/lib/types.ts
WINOGENDER_LAYOUT = lit_dtypes.LitComponentLayout(
    components={
        "Main": [
            "data-table-module",
            "datapoint-editor-module",
            "lit-slice-module",
            "color-module",
        ],
        "Predictions": [
            "span-graph-gold-module",
            "span-graph-module",
            "classification-module",
        ],
        "Performance": [
            "metrics-module",
            "scalar-module",
            "confusion-matrix-module",
        ],
    },
    description="Custom layout for the Winogender coreference demo.",
)
CUSTOM_LAYOUTS = {"winogender": WINOGENDER_LAYOUT}

FLAGS.set_default("default_layout", "winogender")

示例#3
0
flags.DEFINE_bool(
    "load_bwb", False,
    "If true, will load examples from the Billion Word Benchmark dataset. This may download a lot of data the first time you run it, so disable by default for the quick-start example."
)

# Custom frontend layout; see client/lib/types.ts
LM_LAYOUT = lit_dtypes.LitComponentLayout(
    components={
        "Main": [
            "embeddings-module",
            "data-table-module",
            "datapoint-editor-module",
            "lit-slice-module",
            "color-module",
        ],
        "Predictions": [
            "lm-prediction-module",
            "confusion-matrix-module",
        ],
        "Counterfactuals": ["generator-module"],
    },
    description="Custom layout for language models.",
)
CUSTOM_LAYOUTS = {"lm": LM_LAYOUT}

# You can also change this via URL param e.g. localhost:5432/?layout=default
FLAGS.set_default("default_layout", "lm")


def get_wsgi_app():