Hugging Face's logo Hugging Face
    • Models
    • Datasets
    • Pricing
      • Website
        • Metrics
        • Languages
        • Organizations
      • Community
        • Forum
        • Blog
        • GitHub
      • Documentation
        • Model Hub doc
        • Inference API doc
        • Transformers doc
        • Tokenizers doc
        • Datasets doc
    • We're hiring!

    • Log In
    • Sign Up
    • Account
      • Log In
      • Sign Up
    • Website
      • Models
      • Datasets
      • Metrics
      • Languages
      • Organizations
      • Pricing
    • Community
      • Forum
      • Blog
    • Documentation
      • Model Hub doc
      • Inference API doc
      • Transformers doc
      • Tokenizers doc
      • Datasets doc

    Allen Institute for AI's picture allenai
    /
    longformer-large-4096-finetuned-triviaqa

    Question Answering
    PyTorch TensorFlow longformer
    Model card Files and versions

    How to serve this model with the Accelerated Inference API

    Try the Inference API for free, and get an organization plan to use it in your apps.
    import json
    import requests
    
    API_URL = "https://api-inference.huggingface.co/models/allenai/longformer-large-4096-finetuned-triviaqa"
    headers = {"Authorization": f"Bearer {API_TOKEN}"}
    
    def query(payload):
    	data = json.dumps(payload)
    	response = requests.request("POST", API_URL, headers=headers, data=data)
    	return json.loads(response.content.decode("utf-8"))
    data = query(
        {
            "inputs": {
                "question": "What's my name?",
                "context": "My name is Clara and I live in Berkeley.",
            }
        }
    )

    Quick Links

    • Inference API Documentation
    • How to get started

    How to use from the 🤗/transformers library

    from transformers import AutoTokenizer, AutoModelForQuestionAnswering
      
    tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-large-4096-finetuned-triviaqa")
    
    model = AutoModelForQuestionAnswering.from_pretrained("allenai/longformer-large-4096-finetuned-triviaqa")

    Or just clone the model repo

    git lfs install
    git clone https://huggingface.co/allenai/longformer-large-4096-finetuned-triviaqa
    # if you want to clone without large files – just their pointers
    # prepend your git clone with the following env var:
    GIT_LFS_SKIP_SMUDGE=1
      • main
      longformer-large-4096-finetuned-triviaqa
      History: 7 commits
      sgugger's picture
      sgugger
      Move files from roberta-large 4a10c09 last month
      • .gitattributes 345.0B initial commit last year
      • config.json 866.0B Update config.json last year
      • merges.txt 445.6KB Add vocab last year
      • pytorch_model.bin 1.6GB Update pytorch_model.bin last year
      • tf_model.h5 1.6GB Update tf_model.h5 last year
      • tokenizer.json 1.3MB Move files from roberta-large last month
      • vocab.json 877.8KB Add vocab last year