LAnguage Model Analysis

Related tags

Deep Learning LAMA
Overview

LAMA: LAnguage Model Analysis

LAMA

LAMA is a probe for analyzing the factual and commonsense knowledge contained in pretrained language models.

The dataset for the LAMA probe is available at https://dl.fbaipublicfiles.com/LAMA/data.zip

LAMA contains a set of connectors to pretrained language models.
LAMA exposes a transparent and unique interface to use:

  • Transformer-XL (Dai et al., 2019)
  • BERT (Devlin et al., 2018)
  • ELMo (Peters et al., 2018)
  • GPT (Radford et al., 2018)
  • RoBERTa (Liu et al., 2019)

Actually, LAMA is also a beautiful animal.

Reference:

The LAMA probe is described in the following papers:

@inproceedings{petroni2019language,
  title={Language Models as Knowledge Bases?},
  author={F. Petroni, T. Rockt{\"{a}}schel, A. H. Miller, P. Lewis, A. Bakhtin, Y. Wu and S. Riedel},
  booktitle={In: Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2019},
  year={2019}
}

@inproceedings{petroni2020how,
  title={How Context Affects Language Models' Factual Predictions},
  author={Fabio Petroni and Patrick Lewis and Aleksandra Piktus and Tim Rockt{\"a}schel and Yuxiang Wu and Alexander H. Miller and Sebastian Riedel},
  booktitle={Automated Knowledge Base Construction},
  year={2020},
  url={https://openreview.net/forum?id=025X0zPfn}
}

The LAMA probe

To reproduce our results:

1. Create conda environment and install requirements

(optional) It might be a good idea to use a separate conda environment. It can be created by running:

conda create -n lama37 -y python=3.7 && conda activate lama37
pip install -r requirements.txt

2. Download the data

wget https://dl.fbaipublicfiles.com/LAMA/data.zip
unzip data.zip
rm data.zip

3. Download the models

DISCLAIMER: ~55 GB on disk

Install spacy model

python3 -m spacy download en

Download the models

chmod +x download_models.sh
./download_models.sh

The script will create and populate a pre-trained_language_models folder. If you are interested in a particular model please edit the script.

4. Run the experiments

python scripts/run_experiments.py

results will be logged in output/ and last_results.csv.

Other versions of LAMA

LAMA-UHN

This repository also provides a script (scripts/create_lama_uhn.py) to create the data used in (Poerner et al., 2019).

Negated-LAMA

This repository also gives the option to evalute how pretrained language models handle negated probes (Kassner et al., 2019), set the flag use_negated_probes in scripts/run_experiments.py. Also, you should use this version of the LAMA probe https://dl.fbaipublicfiles.com/LAMA/negated_data.tar.gz

What else can you do with LAMA?

1. Encode a list of sentences

and use the vectors in your downstream task!

pip install -e git+https://github.com/facebookresearch/LAMA#egg=LAMA
import argparse
from lama.build_encoded_dataset import encode, load_encoded_dataset

PARAMETERS= {
        "lm": "bert",
        "bert_model_name": "bert-large-cased",
        "bert_model_dir":
        "pre-trained_language_models/bert/cased_L-24_H-1024_A-16",
        "bert_vocab_name": "vocab.txt",
        "batch_size": 32
        }

args = argparse.Namespace(**PARAMETERS)

sentences = [
        ["The cat is on the table ."],  # single-sentence instance
        ["The dog is sleeping on the sofa .", "He makes happy noises ."],  # two-sentence
        ]

encoded_dataset = encode(args, sentences)
print("Embedding shape: %s" % str(encoded_dataset[0].embedding.shape))
print("Tokens: %r" % encoded_dataset[0].tokens)

# save on disk the encoded dataset
encoded_dataset.save("test.pkl")

# load from disk the encoded dataset
new_encoded_dataset = load_encoded_dataset("test.pkl")
print("Embedding shape: %s" % str(new_encoded_dataset[0].embedding.shape))
print("Tokens: %r" % new_encoded_dataset[0].tokens)

2. Fill a sentence with a gap.

You should use the symbol [MASK] to specify the gap. Only single-token gap supported - i.e., a single [MASK].

python lama/eval_generation.py  \
--lm "bert"  \
--t "The cat is on the [MASK]."

cat_on_the_phone

cat_on_the_phone

source: https://commons.wikimedia.org/wiki/File:Bluebell_on_the_phone.jpg

Note that you could use this functionality to answer cloze-style questions, such as:

python lama/eval_generation.py  \
--lm "bert"  \
--t "The theory of relativity was developed by [MASK] ."

Install LAMA with pip

Clone the repo

git clone [email protected]:facebookresearch/LAMA.git && cd LAMA

Install as an editable package:

pip install --editable .

If you get an error in mac os x, please try running this instead

CFLAGS="-Wno-deprecated-declarations -std=c++11 -stdlib=libc++" pip install --editable .

Language Model(s) options

Option to indicate which language model(s) to use:

  • --language-models/--lm : comma separated list of language models (REQUIRED)

BERT

BERT pretrained models can be loaded both: (i) passing the name of the model and using huggingface cached versions or (ii) passing the folder containing the vocabulary and the PyTorch pretrained model (look at convert_tf_checkpoint_to_pytorch in here to convert the TensorFlow model to PyTorch).

  • --bert-model-dir/--bmd : directory that contains the BERT pre-trained model and the vocabulary
  • --bert-model-name/--bmn : name of the huggingface cached versions of the BERT pre-trained model (default = 'bert-base-cased')
  • --bert-vocab-name/--bvn : name of vocabulary used to pre-train the BERT model (default = 'vocab.txt')

RoBERTa

  • --roberta-model-dir/--rmd : directory that contains the RoBERTa pre-trained model and the vocabulary (REQUIRED)
  • --roberta-model-name/--rmn : name of the RoBERTa pre-trained model (default = 'model.pt')
  • --roberta-vocab-name/--rvn : name of vocabulary used to pre-train the RoBERTa model (default = 'dict.txt')

ELMo

  • --elmo-model-dir/--emd : directory that contains the ELMo pre-trained model and the vocabulary (REQUIRED)
  • --elmo-model-name/--emn : name of the ELMo pre-trained model (default = 'elmo_2x4096_512_2048cnn_2xhighway')
  • --elmo-vocab-name/--evn : name of vocabulary used to pre-train the ELMo model (default = 'vocab-2016-09-10.txt')

Transformer-XL

  • --transformerxl-model-dir/--tmd : directory that contains the pre-trained model and the vocabulary (REQUIRED)
  • --transformerxl-model-name/--tmn : name of the pre-trained model (default = 'transfo-xl-wt103')

GPT

  • --gpt-model-dir/--gmd : directory that contains the gpt pre-trained model and the vocabulary (REQUIRED)
  • --gpt-model-name/--gmn : name of the gpt pre-trained model (default = 'openai-gpt')

Evaluate Language Model(s) Generation

options:

  • --text/--t : text to compute the generation for
  • --i : interactive mode
    one of the two is required

example considering both BERT and ELMo:

python lama/eval_generation.py \
--lm "bert,elmo" \
--bmd "pre-trained_language_models/bert/cased_L-24_H-1024_A-16/" \
--emd "pre-trained_language_models/elmo/original/" \
--t "The cat is on the [MASK]."

example considering only BERT with the default pre-trained model, in an interactive fashion:

python lamas/eval_generation.py  \
--lm "bert"  \
--i

Get Contextual Embeddings

python lama/get_contextual_embeddings.py \
--lm "bert,elmo" \
--bmn bert-base-cased \
--emd "pre-trained_language_models/elmo/original/"

Unified vocabulary

The intersection of the vocabularies for all considered models

Troubleshooting

If the module cannot be found, preface the python command with PYTHONPATH=.

If the experiments fail on GPU memory allocation, try reducing batch size.

Acknowledgements

Other References

  • (Kassner et al., 2019) Nora Kassner, Hinrich Schütze. Negated LAMA: Birds cannot fly. arXiv preprint arXiv:1911.03343, 2019.

  • (Poerner et al., 2019) Nina Poerner, Ulli Waltinger, and Hinrich Schütze. BERT is Not a Knowledge Base (Yet): Factual Knowledge vs. Name-Based Reasoning in Unsupervised QA. arXiv preprint arXiv:1911.03681, 2019.

  • (Dai et al., 2019) Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G. Carbonell, Quoc V. Le, and Ruslan Salakhutdi. Transformer-xl: Attentive language models beyond a fixed-length context. CoRR, abs/1901.02860.

  • (Peters et al., 2018) Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. Deep contextualized word representations. NAACL-HLT 2018

  • (Devlin et al., 2018) Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805.

  • (Radford et al., 2018) Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. 2018. Improving language understanding by generative pre-training.

  • (Liu et al., 2019) Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov. 2019. RoBERTa: A Robustly Optimized BERT Pretraining Approach. arXiv preprint arXiv:1907.11692.

Licence

LAMA is licensed under the CC-BY-NC 4.0 license. The text of the license can be found here.

Comments
  • Running setup.py install for fastBPE ... error

    Running setup.py install for fastBPE ... error

    It seems that I struggle with the requirements step ; fastBPE and fairseq are the last 2 module to installed and I run into a problem :

    image

    How to fix that ?

    Thank you for your time,

    Mathieu

    opened by mathieugrasland 6
  • Could you provide your common_vocab_*.txt

    Could you provide your common_vocab_*.txt

    I have tried running thedownlaod_models.sh script. However, my machine can't deal with transformerXL. Could you release your processed common_vocab_*.txt?

    opened by leo-liuzy 4
  • RoBERTa evaluation on LAMA

    RoBERTa evaluation on LAMA

    Thank you for open-sourcing and maintaining such a great project! :)

    I have an issue related to RoBERTa evaluation on LAMA. To evaluate the RoBERTa performance on LAMA, I downloaded RoBERTa {base,large} checkpoints from the fairseq repository. Then I slightly modify run_experiment.py to add RoBERTa to the target LMs as follows:

    LMs = [
        {
            "lm": "roberta",
            "label": "roberta",
            "models_names": ["roberta"],
            "roberta_model_name": "model.pt",
            "roberta_model_dir": "pre-trained_language_models/roberta.large/",
            "roberta_vocab_name": "dict.txt"
        }, ...
    ]
    

    Although the RoBERTa large model is loaded correctly, many warnings show up saying that many words are not included vocab_subset in model.

    2020-03-12 17:55:33,651 - LAMA - WARNING - word wingspan from vocab_subset not in model vocabulary!
    2020-03-12 17:55:33,651 - LAMA - WARNING - word woken from vocab_subset not in model vocabulary!
    2020-03-12 17:55:33,651 - LAMA - WARNING - word wooded from vocab_subset not in model vocabulary!
    2020-03-12 17:55:33,651 - LAMA - WARNING - word wrestled from vocab_subset not in model vocabulary!
    2020-03-12 17:55:33,651 - LAMA - WARNING - word wrinkled from vocab_subset not in model vocabulary!
    2020-03-12 17:55:33,651 - LAMA - WARNING - word yanked from vocab_subset not in model vocabulary!
    2020-03-12 17:55:33,651 - LAMA - WARNING - word yd from vocab_subset not in model vocabulary!
    2020-03-12 17:55:33,651 - LAMA - WARNING - word yellowish from vocab_subset not in model vocabulary!
    2020-03-12 17:55:33,651 - LAMA - WARNING - word yer from vocab_subset not in model vocabulary!
    2020-03-12 17:55:33,651 - LAMA - WARNING - word zu from vocab_subset not in model vocabulary!
    2020-03-12 17:55:33,651 - LAMA - WARNING - word zur from vocab_subset not in model vocabulary!
    

    Then, it was terminated by the error shown below:

    Traceback (most recent call last):
      File "scripts/run_experiments.py", line 221, in <module>
        run_all_LMs(parameters)
      File "scripts/run_experiments.py", line 214, in run_all_LMs
        run_experiments(*parameters, input_param=ip, use_negated_probes=False)
      File "scripts/run_experiments.py", line 135, in run_experiments
        Precision1 = run_evaluation(args, shuffle_data=False, model=model)
      File "/home/akari/projects/LAMA/scripts/batch_eval_KB_completion.py", line 390, in main
        model, data, vocab_subset, args.max_sentence_length, args.template
      File "/home/akari/projects/LAMA/scripts/batch_eval_KB_completion.py", line 233, in filter_samples
        if obj_label_ids:
    RuntimeError: bool value of Tensor with more than one value is ambiguous
    

    Do you have any insights into why many words are not found in vocab_subset and how we could solve the RuntimeError.

    opened by AkariAsai 3
  • ModuleNotFoundError: No module named 'lama'

    ModuleNotFoundError: No module named 'lama'

    I got the following error while executing ./download_dataset.sh for the first time. The same problem appears when I tried to execute the same script again.

    Building common vocab                        
    Traceback (most recent call last):           
      File "lama/vocab_intersection.py", line 7, 
    in <module>                                  
        from lama.modules import build_model_by_n
    ame                                          
    ModuleNotFoundError: No module named 'lama'
    
    opened by sanjibnarzary 3
  • Negated templates for T-REx?

    Negated templates for T-REx?

    Hi,

    When trying to run experiments, I'm getting errors in T-Rex regarding "template_negated" (full error below). It seems the file relations.jsonl contains a bunch of examples where the key "template" is present but the key "template_negated" is not, which makes this part of the code (in run_experiments.py) fail:

    if "template" in relation:
        PARAMETERS["template"] = relation["template"]
        PARAMETERS["template_negated"] = relation["template_negated"]
    

    Is the file relations.jsonl missing these keys?

    Thanks!


    Error + relation print:

    2. T-REx
    bert_base
    {'description': 'most specific known '
                    '(e.g. city instead of '
                    'country, or hospital '
                    'instead of city) birth '
                    'location of a person, '
                    'animal or fictional '
                    'character',
     'label': 'place of birth',
     'relation': 'P19',
     'template': '[X] was born in [Y] .',
     'type': 'N-1'}
    Traceback (most recent call last):
      File "scripts/run_experiments.py", line 215, in <module>
        run_all_LMs(parameters)
      File "scripts/run_experiments.py", line 204, in run_all_LMs
        run_experiments(*parameters, input_param=ip, use_negated_probes=True)
      File "scripts/run_experiments.py", line 114, in run_experiments
        PARAMETERS["template_negated"] = relation["template_negated"]
    KeyError: 'template_negated'
    
    opened by gabrielilharco 3
  • Reproduce results in the paper

    Reproduce results in the paper

    Hi,

    I was trying to reproduce results by running your code, and couldn't get exactly the same precision on SQuAD. Here is what I got for bert_large model on SQuAD: all_samples: 303 list_of_results: 303 global MRR: 0.3018861233236291 global Precision at 10: 0.5676567656765676 global Precision at 1: 0.16831683168316833

    However, in the paper, the table shows that there should be 305 samples and the precision should be 17.4%.

    At first, I guessed that it is because 2 samples are excluded because their object labels are out of the common vocabulary, but even after testing without common vocabulary, I got global Precision at 1: 0.1704918, which is still different to results in the paper.

    Is there a way to reproduce the same results in the paper? Please correct me if I made any mistakes! Thanks!

    opened by a3616001 3
  • Improve resuming download_models.sh

    Improve resuming download_models.sh

    When downloads fail half way through, the directory-based checks are too lax as the checked directories are created before downloading any assets.

    Resume each step until the last part of each step completes.

    CLA Signed 
    opened by darrengarvey 3
  • KG evaluation datasets?

    KG evaluation datasets?

    Nice work on the EMNLP paper "Language Models as Knowledge Bases?", and thanks for making the code available.

    Are the datasets available to reproduce the results from the paper, namely Table 2?

    opened by matt-peters 3
  • Fix corruptions in create_lama_uhn script

    Fix corruptions in create_lama_uhn script

    Summary

    It appears that some corruptions were introduced to the scripts/create_lama_uhn.py script in this commit: https://github.com/facebookresearch/LAMA/commit/ee323ac6f75abd9e1a5e4b5c7dc52a107e4bc9b2#diff-6b6575683d27050e6e5e3096a26d059d. For instance, line 28 was removed which leaves a Python syntax error.

    This PR reverts the unintended line removals to make the script run.

    Testing

    I ran the script to ensure that it worked with Google_RE.

    CLA Signed 
    opened by thesamuel 2
  • How to load a huggingface RoBERTa checkpoint?

    How to load a huggingface RoBERTa checkpoint?

    Hello, Thanks for your great job. I have one problem. I saw in the project, the "roberta_connector.py" load a FAIRSEQ RoBERTa, but I want to load huggingface RoBERTa. What should I do? Could you give me some advice? Thanks a lot.

    opened by ruizewang 2
  • Added LAMA-UHN creation script

    Added LAMA-UHN creation script

    Added a script to create LAMA-UHN (UnHelpfulNames), a subset of LAMA-Google-RE and LAMA-T-REx where questions with overly helpful subject names are filtered out. Overly helpful subject names are:

    1. subject names that contain the correct answer as a (case-insensitive) substring (e.g., Apple Watch -> Apple)
    2. person names that are considered by BERT as a common name in the country, language or city that is the correct answer (e.g., Malakhov -> Russian)
    opened by NPoe 2
  • Ok, I see. The provided `common_vocab_cased.txt` does have `1990s` and `1970s `. So I think the problem probably lies in the `vocab_intersection.py` ?

    Ok, I see. The provided `common_vocab_cased.txt` does have `1990s` and `1970s `. So I think the problem probably lies in the `vocab_intersection.py` ?

        Ok, I see. The provided `common_vocab_cased.txt` does have `1990s` and `1970s `. So I think the problem probably lies in the `vocab_intersection.py` ?
    

    Originally posted by @Hannibal046 in https://github.com/facebookresearch/LAMA/issues/51#issuecomment-1114901454

    opened by Yowyaz 0
  • Bump numpy from 1.15.1 to 1.22.0

    Bump numpy from 1.15.1 to 1.22.0

    Bumps numpy from 1.15.1 to 1.22.0.

    Release notes

    Sourced from numpy's releases.

    v1.22.0

    NumPy 1.22.0 Release Notes

    NumPy 1.22.0 is a big release featuring the work of 153 contributors spread over 609 pull requests. There have been many improvements, highlights are:

    • Annotations of the main namespace are essentially complete. Upstream is a moving target, so there will likely be further improvements, but the major work is done. This is probably the most user visible enhancement in this release.
    • A preliminary version of the proposed Array-API is provided. This is a step in creating a standard collection of functions that can be used across application such as CuPy and JAX.
    • NumPy now has a DLPack backend. DLPack provides a common interchange format for array (tensor) data.
    • New methods for quantile, percentile, and related functions. The new methods provide a complete set of the methods commonly found in the literature.
    • A new configurable allocator for use by downstream projects.

    These are in addition to the ongoing work to provide SIMD support for commonly used functions, improvements to F2PY, and better documentation.

    The Python versions supported in this release are 3.8-3.10, Python 3.7 has been dropped. Note that 32 bit wheels are only provided for Python 3.8 and 3.9 on Windows, all other wheels are 64 bits on account of Ubuntu, Fedora, and other Linux distributions dropping 32 bit support. All 64 bit wheels are also linked with 64 bit integer OpenBLAS, which should fix the occasional problems encountered by folks using truly huge arrays.

    Expired deprecations

    Deprecated numeric style dtype strings have been removed

    Using the strings "Bytes0", "Datetime64", "Str0", "Uint32", and "Uint64" as a dtype will now raise a TypeError.

    (gh-19539)

    Expired deprecations for loads, ndfromtxt, and mafromtxt in npyio

    numpy.loads was deprecated in v1.15, with the recommendation that users use pickle.loads instead. ndfromtxt and mafromtxt were both deprecated in v1.17 - users should use numpy.genfromtxt instead with the appropriate value for the usemask parameter.

    (gh-19615)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    CLA Signed dependencies 
    opened by dependabot[bot] 0
  • Horizon Zero Dawn Nexusmods

    Horizon Zero Dawn Nexusmods

    In Nexusmods Of Horizon Zero Dawn Mods, Whenever Fireclaw Does It's Ground Lava Fountain Attack It Crashes The Game, Plz Fix It As Soon As Possible THANKS 👍🔥❤️ WE ARE WAITING!

    opened by Beastak242021 0
  • import allennlp.modules.highway fails

    import allennlp.modules.highway fails

    I just installed LAMA without error on Ubuntu 20. The run_experiment script immediately crashes because of the following import: when I open python and just run

    import allennlp.modules
    

    I've got this error:

    >>> import allennlp.modules
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/allennlp/modules/__init__.py", line 9, in <module>
        from allennlp.modules.elmo import Elmo
      File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/allennlp/modules/elmo.py", line 20, in <module>
        from allennlp.modules.highway import Highway
      File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/allennlp/modules/highway.py", line 12, in <module>
        class Highway(torch.nn.Module):
      File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/allennlp/modules/highway.py", line 49, in Highway
        def forward(self, inputs: torch.Tensor) -> torch.Tensor:  # pylint: disable=arguments-differ
      File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/overrides/overrides.py", line 88, in overrides
        return _overrides(method, check_signature, check_at_runtime)
      File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/overrides/overrides.py", line 114, in _overrides
        _validate_method(method, super_class, check_signature)
      File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/overrides/overrides.py", line 135, in _validate_method
        ensure_signature_is_compatible(super_method, method, is_static)
      File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/overrides/signature.py", line 104, in ensure_signature_is_compatible
        method_name,
      File "/home/xtof/anaconda3/envs/lama37/lib/python3.7/site-packages/overrides/signature.py", line 211, in ensure_all_positional_args_defined_in_sub
        raise TypeError(f"{method_name}: `{super_param.name}` must be present")
    TypeError: Highway.forward: `input` must be present
    

    Thank you !

    opened by cerisara 4
  • RuntimeError: invalid argument 2: k not in range for dimension.

    RuntimeError: invalid argument 2: k not in range for dimension.

    Hi, I followed the requirements to install the environment. But when I run the scripts/run_experiments.py, there is a bug in __max_probs_values_indices: RuntimeError: invalid argument 2: k not in range for dimension at /pytorch/aten/src/TH/generic/THTensorMoreMath.cpp:1190

    I checked the log_prob is 28 but k is 10000, which exceeds.

    opened by LinhanZ 0
Owner
Meta Research
Meta Research
Step by Step on how to create an vision recognition model using LOBE.ai, export the model and run the model in an Azure Function

Step by Step on how to create an vision recognition model using LOBE.ai, export the model and run the model in an Azure Function

El Bruno 3 Mar 30, 2022
Delta Conformity Sociopatterns Analysis - Delta Conformity Sociopatterns Analysis

Delta_Conformity_Sociopatterns_Analysis ∆-Conformity is a local homophily measur

null 2 Jan 9, 2022
Streamlit App For Product Analysis - Streamlit App For Product Analysis

Streamlit_App_For_Product_Analysis Здравствуйте! Перед вами дашборд, позволяющий

Grigory Sirotkin 1 Jan 10, 2022
Web mining module for Python, with tools for scraping, natural language processing, machine learning, network analysis and visualization.

Pattern Pattern is a web mining module for Python. It has tools for: Data Mining: web services (Google, Twitter, Wikipedia), web crawler, HTML DOM par

Computational Linguistics Research Group 8.4k Jan 3, 2023
Pre-trained BERT Models for Ancient and Medieval Greek, and associated code for LaTeCH 2021 paper titled - "A Pilot Study for BERT Language Modelling and Morphological Analysis for Ancient and Medieval Greek"

Ancient Greek BERT The first and only available Ancient Greek sub-word BERT model! State-of-the-art post fine-tuning on Part-of-Speech Tagging and Mor

Pranaydeep Singh 22 Dec 8, 2022
Collection of NLP model explanations and accompanying analysis tools

Thermostat is a large collection of NLP model explanations and accompanying analysis tools. Combines explainability methods from the captum library wi

null 126 Nov 22, 2022
Meta Language-Specific Layers in Multilingual Language Models

Meta Language-Specific Layers in Multilingual Language Models This repo contains the source codes for our paper On Negative Interference in Multilingu

Zirui Wang 20 Feb 13, 2022
Alex Pashevich 62 Dec 24, 2022
PyTorch code for BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation

BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation

Salesforce 1.3k Dec 31, 2022
The source code for Generating Training Data with Language Models: Towards Zero-Shot Language Understanding.

SuperGen The source code for Generating Training Data with Language Models: Towards Zero-Shot Language Understanding. Requirements Before running, you

Yu Meng 38 Dec 12, 2022
GLM (General Language Model)

GLM GLM is a General Language Model pretrained with an autoregressive blank-filling objective and can be finetuned on various natural language underst

THUDM 421 Jan 4, 2023
CausaLM: Causal Model Explanation Through Counterfactual Language Models

CausaLM: Causal Model Explanation Through Counterfactual Language Models Authors: Amir Feder, Nadav Oved, Uri Shalit, Roi Reichart Abstract: Understan

Amir Feder 39 Jul 10, 2022
Implemented fully documented Particle Swarm Optimization algorithm (basic model with few advanced features) using Python programming language

Implemented fully documented Particle Swarm Optimization (PSO) algorithm in Python which includes a basic model along with few advanced features such as updating inertia weight, cognitive, social learning coefficients and maximum velocity of the particle.

null 9 Nov 29, 2022
deep learning model that learns to code with drawing in the Processing language

sketchnet sketchnet - processing code generator can we teach a computer to draw pictures with code. We use Processing and java/jruby code paired with

null 41 Dec 12, 2022
A heterogeneous entity-augmented academic language model based on Open Academic Graph (OAG)

Library | Paper | Slack We released two versions of OAG-BERT in CogDL package. OAG-BERT is a heterogeneous entity-augmented academic language model wh

THUDM 58 Dec 17, 2022
RoBERTa Marathi Language model trained from scratch during huggingface 🤗 x flax community week

RoBERTa base model for Marathi Language (मराठी भाषा) Pretrained model on Marathi language using a masked language modeling (MLM) objective. RoBERTa wa

Nipun Sadvilkar 23 Oct 19, 2022
🐥A PyTorch implementation of OpenAI's finetuned transformer language model with a script to import the weights pre-trained by OpenAI

PyTorch implementation of OpenAI's Finetuned Transformer Language Model This is a PyTorch implementation of the TensorFlow code provided with OpenAI's

Hugging Face 1.4k Jan 5, 2023
Versatile Generative Language Model

Versatile Generative Language Model This is the implementation of the paper: Exploring Versatile Generative Language Model Via Parameter-Efficient Tra

Zhaojiang Lin 17 Dec 2, 2022
Code for EmBERT, a transformer model for embodied, language-guided visual task completion.

Code for EmBERT, a transformer model for embodied, language-guided visual task completion.

null 41 Jan 3, 2023