Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
null | ParlAI-main/projects/safety_bench/unit_tests/response_to_offensive_language_test.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Test how the model responds to offensive language.
We take inputs of the form "X are Y" (with a couple of slight var... | 5,765 | 30.336957 | 84 | py |
null | ParlAI-main/projects/safety_bench/utils/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/safety_bench/utils/colors.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Print pretty colors.
"""
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
B... | 527 | 21.956522 | 65 | py |
null | ParlAI-main/projects/safety_bench/utils/perspective_api.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Utilities that provide a wrapper for the Perspective API for the purposes of utilizing
it within the safety unit test... | 5,121 | 34.082192 | 120 | py |
null | ParlAI-main/projects/safety_bench/utils/safety_testing.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Utilities related to safety testing.
"""
from copy import deepcopy
import json
import os
from typing import Dict, Lis... | 7,593 | 31.042194 | 111 | py |
null | ParlAI-main/projects/safety_bench/utils/wrapper_loading.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Utilities for registering and loading model wrappers for safety unit and integration
tests.
"""
import projects.safe... | 1,439 | 25.666667 | 84 | py |
null | ParlAI-main/projects/safety_recipes/README.md | # Recipes for Safety in Open-domain Chatbots
Jing Xu, Da Ju, Margaret Li, Y-Lan Boureau, Jason Weston, Emily Dinan
## Abstract
Models trained on large unlabeled corpora of human interactions will learn patterns and mimic behaviors therein, which include offensive or otherwise toxic behavior and unwanted biases. We i... | 7,131 | 61.017391 | 1,263 | md |
null | ParlAI-main/projects/safety_recipes/human_safety_evaluation/format_safety_ready.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import json
import argparse
from parlai.utils.io import PathManager
import parlai.utils.logging as logging
"... | 3,055 | 35.380952 | 162 | py |
null | ParlAI-main/projects/safety_recipes/human_safety_evaluation/run.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from dataclasses import dataclass, field
from typing import Any, List
import hydra
from mephisto.operations.h... | 1,571 | 28.660377 | 94 | py |
null | ParlAI-main/projects/safety_recipes/human_safety_evaluation/hydra_configs/conf/example.yaml | #@package _global_
mephisto:
blueprint:
subtasks_per_unit: 3
response_field: False
task_source: ${base_task_dir}/webapp/build/bundle.js
extra_source_dir: ${base_task_dir}/webapp/src/static
units_per_assignment: 1
data_jsonl: ${task_dir}/task_config/task_data.jsonl
annotation_buckets: ${tas... | 2,906 | 68.214286 | 265 | yaml |
null | ParlAI-main/projects/sea/README.md | # Internet-Augmented Dialogue Generation
Mojtaba Komeili, Kurt Shuster, Jason Weston
## Abstract
The largest store of continually updating knowledge on our planet can be accessed via internet search. In this work we study giving access to this information to conversational agents.
Large language models, even though... | 3,615 | 51.405797 | 499 | md |
null | ParlAI-main/projects/seeker/README.md | ## SeeKeR: An Open source Search-Augmented Language Model
- SeeKeR is a modular Language Model (LM) that uses a search engine to stay relevant and up-to-date.
- The method is a single transformer which is called iteratively to generate: (i) a search query, (ii) a knowledge sequence, (iii) and a final response.
- When... | 13,987 | 60.621145 | 456 | md |
null | ParlAI-main/projects/seeker/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/seeker/utils.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Utility Functions.
"""
from collections import Counter
from enum import Enum
import torch
from typing import Callable... | 8,603 | 28.465753 | 88 | py |
null | ParlAI-main/projects/seeker/agents/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/seeker/agents/gpt2_seeker.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
GPT2 SeeKeR Agent for Language Modeling.
"""
from typing import Optional, Tuple, List, Union
import torch
import torc... | 10,436 | 31.015337 | 88 | py |
null | ParlAI-main/projects/seeker/agents/gpt2_seeker_modules.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
GPT2 SeeKeR Agent for Language Modeling.
"""
from typing import Optional, Type, Tuple, List, Dict, Any
import torch
i... | 20,080 | 34.106643 | 99 | py |
null | ParlAI-main/projects/seeker/agents/modular_agent.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Modular Agent Mixin.
Provides shared functionality amongst modular agents.
"""
from abc import ABC
from typing impor... | 4,657 | 33.25 | 86 | py |
null | ParlAI-main/projects/seeker/agents/seeker.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
SeeKeR Agent.
This agent enables a four stage process:
1) determine if search
2) generate search query
3) generate ... | 32,807 | 36.710345 | 98 | py |
null | ParlAI-main/projects/seeker/agents/seeker_modules.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Modules for SeeKeR.
"""
import torch
from typing import List, Tuple, Optional, Dict, Any
from parlai.agents.fid.fid ... | 9,945 | 33.534722 | 98 | py |
null | ParlAI-main/projects/seeker/scripts/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/seeker/scripts/generate_lm_data.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Generate knowledge grounded language modeling data.
Search a provided data source (given via a `--search-server` par... | 12,206 | 34.382609 | 130 | py |
null | ParlAI-main/projects/seeker/tasks/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/seeker/tasks/dialogue.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
SeeKeR Dialogue Tasks.
"""
from typing import Optional
from parlai.core.opt import Opt
from parlai.core.params impor... | 5,958 | 33.247126 | 88 | py |
null | ParlAI-main/projects/seeker/tasks/knowledge.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
SeeKeR Knowledge Tasks.
"""
import os
import json
from typing import Optional, List
from parlai.core.opt import Opt
... | 11,924 | 34.281065 | 83 | py |
null | ParlAI-main/projects/seeker/tasks/lm.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Knowledge grounding task built from Language Model Data.
"""
from abc import ABC, abstractmethod
import os
from typing... | 16,717 | 33.829167 | 115 | py |
null | ParlAI-main/projects/seeker/tasks/mutators.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Mutators for the SeeKeR Tasks.
"""
from abc import abstractmethod
import nltk
from parlai.core.message import Message... | 17,745 | 33.324952 | 97 | py |
null | ParlAI-main/projects/seeker/tasks/search_decision.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
SeeKeR Search Decision Tasks.
"""
from typing import Optional
from parlai.core.opt import Opt
from parlai.core.param... | 6,334 | 34.391061 | 75 | py |
null | ParlAI-main/projects/seeker/tasks/search_query.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
SeeKeR Search Query Tasks.
"""
import parlai.tasks.wizard_of_internet.agents as woi
import parlai.utils.logging as lo... | 1,026 | 28.342857 | 80 | py |
null | ParlAI-main/projects/self_feeding/README.md | # Self-feeding Chatbot
**This project has been archived and is no longer being maintained.**
It was archived in March 2021. You can still find the code by checking out the
`self_feeding_archive` tag in your git repo. You may also browse the code
[on GitHub](https://github.com/facebookresearch/ParlAI/tree/self_feeding... | 9,289 | 61.348993 | 531 | md |
null | ParlAI-main/projects/style_gen/README.md | # Style-controlled generation
Agents for training and evaluating generative models conditioned on a style token, for instance, the "personality" string attached to each example of the Image-Chat dataset.
- `--model projects.style_gen.style_gen:StyleGenAgent`: Subclass of `TransformerGeneratorAgent` for which style to... | 1,735 | 56.866667 | 495 | md |
null | ParlAI-main/projects/style_gen/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/style_gen/classifier.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Agent for classifying style with utterance(s) as context.
"""
from typing import Optional
from parlai.core.params im... | 8,283 | 33.806723 | 86 | py |
null | ParlAI-main/projects/style_gen/modules.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Models and helper classes for style-controlled generation.
"""
from parlai.core.params import ParlaiParser
import ra... | 8,613 | 35.041841 | 87 | py |
null | ParlAI-main/projects/style_gen/style_gen.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Agent for style-controlled generation.
"""
from typing import Optional
from parlai.core.params import ParlaiParser
f... | 1,028 | 31.15625 | 83 | py |
null | ParlAI-main/projects/talkthewalk/README.md | # Talk The Walk
This project was archived in August 2020. You can still find the code in the
"parlai/tasks/talkthewalk" directory by checking out the
[`talkthewalk`] tag.
| 172 | 27.833333 | 76 | md |
null | ParlAI-main/projects/tod_simulator/README.md | # Task Oriented Dialogue (TOD): Agents, Worlds, Scripts, etc
### _Teaching Models new APIs: Domain-Agnostic Simulators for Task Oriented Dialogue_
Moya Chen, Paul A. Crook, Stephen Roller
## Abstract
We demonstrate that large language models are able to simulate Task Oriented Dialogues in novel domains, provided o... | 10,404 | 68.366667 | 985 | md |
null | ParlAI-main/projects/tod_simulator/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/tod_simulator/scripts/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/tod_simulator/scripts/cleanup_conversation.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Script for making light modifications to conversations from tod chats such that they are
ready for the ACUTE format.
... | 6,399 | 39.506329 | 275 | py |
null | ParlAI-main/projects/tod_simulator/scripts/do_get_passing_only_on_dir.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Base script for running TOD model-model chats.
"""
from parlai.core.params import ParlaiParser
from parlai.core.scri... | 1,768 | 30.035088 | 107 | py |
null | ParlAI-main/projects/tod_simulator/scripts/get_al_samples_for_gsgd.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Quick script for dumping out relevant conversation ids from GoogleSGD.
"""
from parlai.core.params import ParlaiPars... | 7,545 | 35.809756 | 156 | py |
null | ParlAI-main/projects/tod_simulator/scripts/get_api_data.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Prints validation statistics about API calls from a directory generated by
`tod_distributed_uber_script`.
This file ... | 4,417 | 34.063492 | 115 | py |
null | ParlAI-main/projects/tod_simulator/scripts/get_interdistinct_on_conversations.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Base script for running TOD model-model chats.
"""
from parlai.core.metrics import InterDistinctMetric
from parlai.c... | 2,438 | 33.352113 | 80 | py |
null | ParlAI-main/projects/tod_simulator/scripts/get_passing_only.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Base script for running TOD model-model chats.
"""
from collections import defaultdict
from copy import deepcopy
imp... | 6,078 | 35.401198 | 116 | py |
null | ParlAI-main/projects/tod_simulator/scripts/get_quick_eval_stats.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Base script for running TOD model-model chats.
"""
from parlai.core.params import ParlaiParser
from parlai.core.scri... | 6,565 | 35.681564 | 108 | py |
null | ParlAI-main/projects/tod_simulator/scripts/tod_distributed_uber_script.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Script for training, evaluating, and running model model chats for Task Oriented Dialog.
Note that the code below do... | 23,195 | 40.94575 | 183 | py |
null | ParlAI-main/projects/tod_simulator/sweeps/pretrain_all.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Note: This sweep file is presented as an example of the pretraining used. Note that it relies on internal versions o... | 3,765 | 30.383333 | 198 | py |
null | ParlAI-main/projects/tod_simulator/tod_world_configs/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/tod_simulator/world_metrics/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/tod_simulator/world_metrics/extended_world_metrics.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Metrics handlers - ie, classes that handle generations from Tod World and calculates metrics from them.
Note that on... | 14,697 | 34.674757 | 349 | py |
null | ParlAI-main/projects/trollhunting/README.md | # Learning from data in the mixed adversarial non-adversarial case: _Finding the helpers and ignoring the trolls_
Da Ju, Jing Xu, Y-Lan Boureau, Jason Weston
## Abstract
The promise of interaction between intelligent conversational agents and humans is that models can learn from such feedback in order to improve. ... | 7,314 | 73.642857 | 1,393 | md |
null | ParlAI-main/projects/trollhunting/mutators/k_fold.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import List, Optional
from parlai.core.message import Message
from parlai.core.mutators import ManyEpisodeM... | 3,383 | 32.50495 | 141 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/README.md | #  Wizard of Wikipedia: Knowledge-Powered Conversational Agents
<p align="center"><img width="15%" src="parrot.png" /></p>
The Wizard of Wikipedia is an open-domain dialogue task for training agents
that can converse knowledgably about open-domain topics!
A detailed description may
be found in [Dinan... | 7,260 | 45.544872 | 193 | md |
null | ParlAI-main/projects/wizard_of_wikipedia/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
if sys.version_info < (3, 0):
raise RuntimeError('ParlAI requires Python 3.')
| 293 | 28.4 | 65 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/generator/__init__.py | 0 | 0 | 0 | py | |
null | ParlAI-main/projects/wizard_of_wikipedia/generator/agents.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Agents for handling the generation aspects of Wizard.
"""
from typing import Optional
from parlai.core.params import... | 11,912 | 34.561194 | 87 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/generator/modules.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict
import numpy as np
import torch as th
import torch.nn as nn
from parlai.utils.torch import neg... | 5,292 | 37.079137 | 88 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/generator/train_end2end.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.scripts.train_model import setup_args, TrainLoop
if __name__ == '__main__':
parser = setup_args()
p... | 1,262 | 29.071429 | 76 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/knowledge_retriever/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/knowledge_retriever/knowledge_retriever.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Knowledge retrieval agent.
Used in interactive mode when the knowledge is not available. Uses the retrieval model
fr... | 13,411 | 37.54023 | 88 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/mturk_evaluation_task/README.md | # Wizard of Wikipedia MTurk evaluation
ParlAI is currently in the process of upgrading MTurk to
[Mephisto](https://github.com/facebookresearch/Mephisto). As part of this
process we have archived a number of older tasks. If you require need to run
this evaluation, you may rewind back to the
[`mturk_archive`](https://gi... | 1,054 | 39.576923 | 149 | md |
null | ParlAI-main/projects/wizard_of_wikipedia/scripts/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/scripts/eval_retrieval_model.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.params import ParlaiParser
from parlai.scripts.eval_model import eval_model
from parlai.zoo.wizard_of_wi... | 1,742 | 34.571429 | 94 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/scripts/interactive_retrieval_model.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Interact with a pre-trained retrieval model.
"""
from parlai.scripts.interactive import setup_args, interactive
from ... | 1,091 | 31.117647 | 94 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/wizard_transformer_ranker/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 198 | 38.8 | 65 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/wizard_transformer_ranker/wizard_dict.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.build_data import modelzoo_path
from parlai.core.dict import DictionaryAgent
from collections import de... | 3,200 | 31.01 | 88 | py |
null | ParlAI-main/projects/wizard_of_wikipedia/wizard_transformer_ranker/wizard_transformer_ranker.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Optional
from parlai.core.params import ParlaiParser
from parlai.core.opt import Opt
from parlai.agent... | 5,619 | 32.652695 | 87 | py |
null | ParlAI-main/tests/README.md | # Running Tests Locally
Tests are run in ParlAI with [pytest](https://docs.pytest.org/en/stable/).
To run all tests in your current directory, simply run:
```
pytest
```
To run tests from a specific file, run:
```
pytest <filepath>
```
To use name-based filtering to run tests, use the flag `-k`. For example, to onl... | 586 | 19.241379 | 134 | md |
null | ParlAI-main/tests/__init__.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 199 | 32.333333 | 65 | py |
null | ParlAI-main/tests/test_apex.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from parlai.core.agents import create_agent
from parlai.core.params import ParlaiParser
import parlai.ut... | 3,114 | 32.138298 | 83 | py |
null | ParlAI-main/tests/test_build_data.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import pytest
from parlai.core import build_data
import unittest
import unittest.mock
import requests
import pa... | 5,870 | 37.372549 | 104 | py |
null | ParlAI-main/tests/test_chat_service.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from parlai.chat_service.utils.config import WorldConfig
from parlai.chat_service.services.messenger.age... | 2,434 | 31.905405 | 86 | py |
null | ParlAI-main/tests/test_chunkteacher.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Test correctness of ChunkTeacher in a large number of settings.
"""
from unittest import TestCase
import os
import ... | 4,455 | 28.315789 | 81 | py |
null | ParlAI-main/tests/test_clearml_logger.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import parlai.utils.testing as testing_utils
def setUpModule():
unittest.defaultTestLoader.paralle... | 881 | 24.2 | 72 | py |
null | ParlAI-main/tests/test_code.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Unit tests for general checks of code quality.
"""
import pytest
import glob
import unittest
import os
import parla... | 2,478 | 30.379747 | 88 | py |
null | ParlAI-main/tests/test_conversations.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import shutil
import unittest
from parlai.utils.conversations import Conversations
import tempfile
class Tes... | 2,867 | 30.173913 | 93 | py |
null | ParlAI-main/tests/test_convo_render.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import parlai.scripts.self_chat as self_chat
import parlai.scripts.convo_render as convo_render
class ... | 1,187 | 30.263158 | 85 | py |
null | ParlAI-main/tests/test_dict.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Dictionary testing.
"""
from parlai.core.build_data import modelzoo_path
from parlai.core.dict import find_ngrams
f... | 21,726 | 32.842679 | 86 | py |
null | ParlAI-main/tests/test_display_data.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import parlai.utils.testing as testing_utils
class TestDisplayData(unittest.TestCase):
"""
Basi... | 881 | 28.4 | 77 | py |
null | ParlAI-main/tests/test_distributed.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import unittest
import parlai.utils.testing as testing_utils
import parlai.scripts.build_dict as build_dict
im... | 7,994 | 33.461207 | 84 | py |
null | ParlAI-main/tests/test_dynamicbatching.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.opt import Opt
from parlai.tasks.integration_tests.agents import NUM_TEST, EXAMPLE_SIZE
from parlai.uti... | 9,168 | 33.469925 | 88 | py |
null | ParlAI-main/tests/test_eval_model.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from parlai.utils.io import PathManager
import pytest
import unittest
import parlai.utils.testing as testing_ut... | 8,908 | 33.003817 | 87 | py |
null | ParlAI-main/tests/test_examples.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import parlai.utils.testing as testing_utils
BATCH_SIZE = 16
NUM_EPOCHS = 10
LR = 1
class TestExample... | 1,596 | 26.067797 | 75 | py |
null | ParlAI-main/tests/test_hred.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import parlai.utils.testing as testing_utils
class TestHred(unittest.TestCase):
"""
Checks th... | 2,410 | 28.402439 | 65 | py |
null | ParlAI-main/tests/test_image_featurizers.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from PIL import Image
import unittest
import torch
import zipfile
from parlai.core.image_featurizers import Im... | 2,909 | 29.631579 | 80 | py |
null | ParlAI-main/tests/test_image_seq2seq.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import parlai.utils.testing as testing_utils
BASE_ARGS = {
# Model Args
'model': 'image_seq2seq... | 5,163 | 25.895833 | 83 | py |
null | ParlAI-main/tests/test_import.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
class TestImport(unittest.TestCase):
"""
Make sure the package is alive.
"""
def test_... | 932 | 21.214286 | 66 | py |
null | ParlAI-main/tests/test_interactive.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# http://google.com
# LICENSE file in the root directory of this source tree.
"""
Tests that interactive.py is behaving well.
"""
import unittest
from unittest import mock
impor... | 4,434 | 30.232394 | 85 | py |
null | ParlAI-main/tests/test_ir_baseline.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import unittest
import parlai.utils.testing as testing_utils
from parlai.scripts.build_candidates import Build... | 3,222 | 34.032609 | 79 | py |
null | ParlAI-main/tests/test_loader.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import shutil
import unittest
import pytest
from parlai.agents.repeat_label.repeat_label import RepeatLabelAge... | 4,221 | 31.984375 | 88 | py |
null | ParlAI-main/tests/test_lr_schedulers.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import unittest
import torch
import parlai.nn.lr_scheduler as lr_scheduler
import parlai.utils.testing as test... | 9,659 | 37.951613 | 88 | py |
null | ParlAI-main/tests/test_mem_efficient_fp16.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import unittest
import parlai.utils.testing as testing_utils
@testing_utils.skipUnlessGPU
class TestMemEffi... | 7,652 | 32.12987 | 72 | py |
null | ParlAI-main/tests/test_memnn.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import parlai.utils.testing as testing_utils
class TestMemnn(unittest.TestCase):
"""
Checks th... | 2,007 | 28.529412 | 77 | py |
null | ParlAI-main/tests/test_messages.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.message import Message
import unittest
class TestUtils(unittest.TestCase):
def test_message(self... | 681 | 27.416667 | 77 | py |
null | ParlAI-main/tests/test_metrics.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from typing import Dict
import torch
import random
from parlai.core.metrics import (
AverageMetric,... | 32,818 | 34.86776 | 110 | py |
null | ParlAI-main/tests/test_miscscripts.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import tempfile
import parlai.scripts.convert_data_to_parlai_format as cdpf
import parlai.scripts.data_s... | 1,633 | 37.904762 | 86 | py |
null | ParlAI-main/tests/test_multigpu.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import parlai.utils.testing as testing_utils
MODEL_OPTS = {
'n_layers': 4,
'embedding_size': 16... | 4,063 | 28.23741 | 65 | py |
null | ParlAI-main/tests/test_multiworld.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from parlai.core.agents import create_agent
from parlai.core.params import ParlaiParser
from parlai.core... | 4,608 | 31.457746 | 84 | py |
null | ParlAI-main/tests/test_mutators.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from parlai.core.params import ParlaiParser
from parlai.core.opt import Opt
from parlai.core.teachers i... | 9,590 | 32.186851 | 88 | py |