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/parlai/agents/test_agents/test_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.
"""
MockTorchAgent.
Mean for unit testing purposes only, and should not be invoked otherwise.
"""
from typing import Op... | 4,375 | 23.176796 | 81 | py |
null | ParlAI-main/parlai/agents/test_agents/transformer_generator_prefix.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 agent which overrides the `get_prefix_tokens` function for Transformer Generator
Agent in order to test its fun... | 971 | 31.4 | 85 | py |
null | ParlAI-main/parlai/agents/test_agents/unigram.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.
"""
UnigramAgent always predicts the unigram distribution.
It is a full TorchGeneratorAgent model, so it can be used he... | 1,387 | 25.692308 | 86 | py |
null | ParlAI-main/parlai/agents/tfidf_retriever/README.md | # TFIDF Retriever
The *TFIDF Retriever* is an agent that constructs a [TF-IDF](https://en.wikipedia.org/wiki/Tf%E2%80%93idf)
matrix for all entries in a given task. It generates responses via
returning the highest-scoring documents for a query. It uses a SQLite database
for storing the sparse tfidf matrix, adapted ... | 902 | 36.625 | 107 | md |
null | ParlAI-main/parlai/agents/tfidf_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/parlai/agents/tfidf_retriever/build_tfidf.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.
"""
A script to build the tf-idf document matrices for retrieval.
Adapted from Adam Fisch's work at github.com/facebookr... | 6,267 | 28.42723 | 81 | py |
null | ParlAI-main/parlai/agents/tfidf_retriever/doc_db.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.
"""
Documents, in a sqlite database.
Adapted from Adam Fisch's work at github.com/facebookresearch/DrQA/
"""
import sql... | 2,100 | 25.935897 | 85 | py |
null | ParlAI-main/parlai/agents/tfidf_retriever/tfidf_doc_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.
"""
Rank documents with TF-IDF scores.
Adapted from Adam Fisch's work at github.com/facebookresearch/DrQA/
"""
import n... | 3,573 | 30.910714 | 87 | py |
null | ParlAI-main/parlai/agents/tfidf_retriever/tfidf_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.
from typing import Optional
from parlai.core.params import ParlaiParser
from parlai.core.opt import Opt
import regex # ... | 9,999 | 35.49635 | 85 | py |
null | ParlAI-main/parlai/agents/tfidf_retriever/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.
"""
Various retriever utilities.
"""
import regex
import unicodedata
import numpy as np
import scipy.sparse as sp
from ... | 4,505 | 16.13308 | 84 | py |
null | ParlAI-main/parlai/agents/tfidf_retriever/tokenizers/__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.
from .regexp_tokenizer import RegexpTokenizer
from .simple_tokenizer import SimpleTokenizer
def set_default(key, value... | 718 | 21.46875 | 65 | py |
null | ParlAI-main/parlai/agents/tfidf_retriever/tokenizers/regexp_tokenizer.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.
"""
Regex based tokenizer that emulates the Stanford/NLTK PTB tokenizers.
However it is purely in Python, supports robu... | 3,970 | 34.455357 | 86 | py |
null | ParlAI-main/parlai/agents/tfidf_retriever/tokenizers/simple_tokenizer.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.
"""
Basic tokenizer that splits text into alpha-numeric tokens and non-whitespace tokens.
"""
import regex
from .tokeni... | 1,630 | 29.203704 | 85 | py |
null | ParlAI-main/parlai/agents/tfidf_retriever/tokenizers/spacy_tokenizer.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.
"""
Tokenizer that is backed by spaCy (spacy.io).
Requires spaCy package and the spaCy english model.
"""
import spacy... | 2,103 | 31.369231 | 74 | py |
null | ParlAI-main/parlai/agents/tfidf_retriever/tokenizers/tokenizer.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 tokenizer/tokens classes and utilities.
"""
class Tokens(object):
"""
A class to represent a list of ... | 2,129 | 23.204545 | 77 | py |
null | ParlAI-main/parlai/agents/transformer/README.md | # Transformer
We offer a variety of agent implementations whose core model is the transformer, a self-attention based encoding mechanism first described in [Vaswani et al 2017](https://arxiv.org/abs/1706.03762).
## Agent Variations
- ``transformer/biencoder`` - A retrieval-based agent that encodes a context sequence... | 1,956 | 107.722222 | 553 | md |
null | ParlAI-main/parlai/agents/transformer/__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/parlai/agents/transformer/biencoder.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.
"""
Bi-encoder Agent.
"""
from typing import Optional
from parlai.core.params import ParlaiParser
from parlai.core.opt imp... | 5,244 | 33.735099 | 87 | py |
null | ParlAI-main/parlai/agents/transformer/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.
# hack to make sure calling '-m transformer/ranker' works.
from .transformer import TransformerClassifierAgent as Classif... | 343 | 42 | 84 | py |
null | ParlAI-main/parlai/agents/transformer/crossencoder.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.
# hack to make sure -m transformer/generator works as expected
from typing import Optional
from parlai.core.params import... | 3,755 | 33.777778 | 83 | py |
null | ParlAI-main/parlai/agents/transformer/decoder.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.agents.transformer.transformer import add_common_cmdline_args
from parlai.core.... | 3,329 | 33.6875 | 85 | py |
null | ParlAI-main/parlai/agents/transformer/dropout_poly.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.
"""
Dropout Poly-encoder.
The dropout poly-encoder mimics a combination of a bi-encoder & poly-encoder during
training, a... | 4,429 | 32.560606 | 88 | py |
null | ParlAI-main/parlai/agents/transformer/generator.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.
# hack to make sure -m transformer/generator works as expected
from .transformer import TransformerGeneratorAgent as Gene... | 345 | 42.25 | 82 | py |
null | ParlAI-main/parlai/agents/transformer/image_polyencoder.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.
# hack to make sure -m transformer/generator works as expected
"""
Poly-encoder agent that ingests image features.
"""
f... | 7,810 | 37.102439 | 91 | py |
null | ParlAI-main/parlai/agents/transformer/polyencoder.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.
# hack to make sure -m transformer/generator works as expected
"""
Poly-encoder Agent.
"""
from parlai.core.params impor... | 22,684 | 35.180223 | 110 | py |
null | ParlAI-main/parlai/agents/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.
# hack to make sure calling '-m transformer/ranker' works.
from .transformer import TransformerRankerAgent as RankerAgent... | 335 | 41 | 76 | py |
null | ParlAI-main/parlai/agents/transformer/transformer.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.
"""
Transformer Agents.
"""
from typing import Optional
from parlai.core.params import ParlaiParser
from parlai.core.opt i... | 15,643 | 32.004219 | 88 | py |
null | ParlAI-main/parlai/agents/transformer/modules/__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.
from .constants import LAYER_NORM_EPS # noqa: F401
from .functions import ( # noqa: F401
create_embeddings,
cre... | 973 | 33.785714 | 88 | py |
null | ParlAI-main/parlai/agents/transformer/modules/attention.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.
"""
Implementations of attention.
"""
import math
from typing import Dict, Tuple, Optional, Union
import torch
import t... | 10,039 | 34.985663 | 110 | py |
null | ParlAI-main/parlai/agents/transformer/modules/constants.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.
LAYER_NORM_EPS = 1e-5 # Epsilon for layer norm.
| 248 | 34.571429 | 65 | py |
null | ParlAI-main/parlai/agents/transformer/modules/decoder.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.
"""
Transformer decoder implementations.
"""
from __future__ import annotations
from abc import ABC
from typing import D... | 27,590 | 33.274534 | 244 | py |
null | ParlAI-main/parlai/agents/transformer/modules/encoder.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.
"""
Transformer encoder implementations.
"""
from __future__ import annotations
from typing import Tuple, Optional, Unio... | 14,521 | 34.419512 | 88 | py |
null | ParlAI-main/parlai/agents/transformer/modules/ffn.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.
"""
Feedforward neural network, as used in transformer implementation.
"""
import torch
import torch.nn as nn
import tor... | 1,712 | 27.081967 | 77 | py |
null | ParlAI-main/parlai/agents/transformer/modules/functions.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.
"""
Pure functions used in transformer implementation.
"""
import numpy as np
import torch
import torch.nn as nn
from p... | 1,802 | 27.171875 | 73 | py |
null | ParlAI-main/parlai/agents/transformer/modules/generator.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.
"""
Implements NN code for transformers.
Original paper: https://arxiv.org/abs/1706.03762. (Vaswani, 2017). The
`Annotat... | 4,674 | 32.633094 | 88 | py |
null | ParlAI-main/parlai/agents/transformer/modules/mem_net.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 torch
import torch.nn as nn
from typing import Optional, Tuple
from parlai.agents.transformer.modules import (
... | 6,176 | 31.856383 | 85 | py |
null | ParlAI-main/parlai/agents/transformer/modules/modular.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.
"""
Tools for annotating modules with lightweight dependency injection.
Primarily designed to swap out individual modules... | 4,897 | 31.223684 | 94 | py |
null | ParlAI-main/parlai/agents/transformer/modules/wrappers.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 torch
import torch.nn as nn
from parlai.agents.transformer.modules import TransformerEncoder
class TransformerR... | 1,560 | 27.381818 | 73 | py |
null | ParlAI-main/parlai/agents/unigram/README.md | # Unigram Agent
Baseline model which predicts the $n$ most common unigrams regardless of input.
## Basic Examples
Training the unigram model on convai2:
```bash
parlai train_model -m unigram -mf unigram.model -t convai2 -eps 1 --num-words 15
```
| 250 | 19.916667 | 80 | md |
null | ParlAI-main/parlai/agents/unigram/__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/parlai/agents/unigram/unigram.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.
"""
Baseline model which always emits the N most common non-punctuation unigrams. Typically
this is mostly stopwords. Th... | 3,913 | 28.651515 | 88 | py |
null | ParlAI-main/parlai/chat_service/README.md | # Setting up ParlAI for a custom chat-service
This is an instruction manual to be used as reference on how to configure ParlAI for an arbitrary chat service.
## Message Format
To maintain consistency we are trying to enforce a deterministic message format throughout this task. If a particular chat service doesn't adhe... | 5,461 | 57.731183 | 420 | md |
null | ParlAI-main/parlai/chat_service/__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/parlai/chat_service/core/__init__.py | 0 | 0 | 0 | py | |
null | ParlAI-main/parlai/chat_service/core/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.
import time
from abc import ABC, abstractmethod
from queue import Queue
from parlai.core.agents import Agent
class Cha... | 4,946 | 29.91875 | 84 | py |
null | ParlAI-main/parlai/chat_service/core/chat_service_manager.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 abc import ABC, abstractmethod
from asyncio import Future
import copy
import sys
import logging
import datetime
imp... | 30,802 | 34.365098 | 88 | py |
null | ParlAI-main/parlai/chat_service/core/socket.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 errno
import json
import logging
import threading
import time
import websocket
import parlai.chat_service.utils.lo... | 5,922 | 33.236994 | 118 | py |
null | ParlAI-main/parlai/chat_service/core/world_runner.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 logging
import time
import datetime
from concurrent import futures
import parlai.chat_service.utils.logging as log... | 7,095 | 35.020305 | 88 | py |
null | ParlAI-main/parlai/chat_service/core/server/__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/parlai/chat_service/services/__init__.py | 0 | 0 | 0 | py | |
null | ParlAI-main/parlai/chat_service/services/browser_chat/README.md | ## Browser Chat
This allows you to participate in a ParlAI world as an agent using a local browser.
This extends the `websocket` chat service implementation to run a server locally,
which you can send and receive messages using a browser.
## Setup
1. Run:
`python parlai/chat_service/services/browser_chat/run.py --co... | 844 | 35.73913 | 159 | md |
null | ParlAI-main/parlai/chat_service/services/browser_chat/__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/parlai/chat_service/services/browser_chat/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.
from parlai.chat_service.services.websocket.agents import WebsocketAgent
class BrowserAgent(WebsocketAgent):
pass
| 320 | 25.75 | 72 | py |
null | ParlAI-main/parlai/chat_service/services/browser_chat/browser_manager.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.chat_service.services.websocket.websocket_manager import WebsocketManager
class BrowserManager(WebsocketMa... | 464 | 26.352941 | 87 | py |
null | ParlAI-main/parlai/chat_service/services/browser_chat/client.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 json
import websocket
import threading
from parlai.core.params import ParlaiParser
from parlai.scripts.interactiv... | 5,420 | 26.517766 | 86 | py |
null | ParlAI-main/parlai/chat_service/services/browser_chat/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.
"""
Browser Chat Runner.
Used to run the browser chat server.
"""
from parlai.core.params import ParlaiParser
from parl... | 1,408 | 24.618182 | 120 | py |
null | ParlAI-main/parlai/chat_service/services/messenger/__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.
# Check 3rd-party dependencies
try:
import joblib # noqa: F401
import websocket # noqa: F401
import sh # ... | 489 | 27.823529 | 65 | py |
null | ParlAI-main/parlai/chat_service/services/messenger/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.
import time
from parlai.chat_service.core.agents import ChatServiceAgent
class MessengerAgent(ChatServiceAgent):
... | 5,685 | 36.407895 | 83 | py |
null | ParlAI-main/parlai/chat_service/services/messenger/message_sender.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 json
import logging
import requests
import parlai.chat_service.utils.logging as log_utils
MAX_QUICK_REPLIES = 10... | 11,419 | 34.138462 | 118 | py |
null | ParlAI-main/parlai/chat_service/services/messenger/messenger_manager.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.
"""
Messenger Manager Module.
Contains implementation of the MessengerManager, which helps run ParlAI via FB
Messenger.
... | 11,193 | 34.536508 | 87 | py |
null | ParlAI-main/parlai/chat_service/services/messenger/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.
"""
Messenger Runner.
"""
from parlai.core.params import ParlaiParser
from parlai.chat_service.services.messenger.messeng... | 1,109 | 22.125 | 85 | py |
null | ParlAI-main/parlai/chat_service/services/messenger/worlds.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.worlds import World
# ----- Baseline overworld that simply defers to the default world ----- #
class ... | 1,262 | 23.288462 | 78 | py |
null | ParlAI-main/parlai/chat_service/services/terminal_chat/README.md | ## Terminal Chat
This allows you to participate in a ParlAI world as an agent using the terminal.
This extends the `websocket` chat service implementation to run a server locally,
which you can send and receive messages from using the terminal.
## Setup
1. Run:
`python parlai/chat_service/services/terminal_chat/run.... | 743 | 38.157895 | 159 | md |
null | ParlAI-main/parlai/chat_service/services/terminal_chat/__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/parlai/chat_service/services/terminal_chat/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.
from parlai.chat_service.services.websocket.agents import WebsocketAgent
class TerminalAgent(WebsocketAgent):
pass... | 321 | 25.833333 | 72 | py |
null | ParlAI-main/parlai/chat_service/services/terminal_chat/client.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 json
import uuid
import websocket
import time
import threading
from parlai.core.params import ParlaiParser
# the... | 3,646 | 24.503497 | 102 | py |
null | ParlAI-main/parlai/chat_service/services/terminal_chat/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.
"""
Terminal Chat Runner.
Used to run the terminal chat server.
"""
from parlai.core.params import ParlaiParser
from pa... | 1,418 | 24.8 | 120 | py |
null | ParlAI-main/parlai/chat_service/services/terminal_chat/terminal_manager.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.chat_service.services.websocket.websocket_manager import WebsocketManager
class TerminalManager(WebsocketM... | 458 | 26 | 88 | py |
null | ParlAI-main/parlai/chat_service/services/websocket/__init__.py | 0 | 0 | 0 | py | |
null | ParlAI-main/parlai/chat_service/services/websocket/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.
import logging
from parlai.chat_service.core.agents import ChatServiceAgent
class WebsocketAgent(ChatServiceAgent):
... | 2,424 | 36.890625 | 81 | py |
null | ParlAI-main/parlai/chat_service/services/websocket/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.
"""
Websocket Runner.
"""
from parlai.core.params import ParlaiParser
from parlai.chat_service.services.websocket.websock... | 1,110 | 22.145833 | 85 | py |
null | ParlAI-main/parlai/chat_service/services/websocket/sockets.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, TypeVar
from tornado.websocket import WebSocketHandler
import uuid
import logging
import json
... | 2,318 | 31.208333 | 85 | py |
null | ParlAI-main/parlai/chat_service/services/websocket/websocket_manager.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.
"""
Websocket Manager Module Contains implementation of the WebsocketManager which helps run
ParlAI via websockets.
"""
i... | 10,414 | 35.289199 | 88 | py |
null | ParlAI-main/parlai/chat_service/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/parlai/chat_service/tasks/chatbot/__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/parlai/chat_service/tasks/chatbot/config.yml | tasks:
default:
onboard_world: MessengerBotChatOnboardWorld
task_world: MessengerBotChatTaskWorld
timeout: 1800
agents_required: 1
task_name: chatbot
world_module: parlai.chat_service.tasks.chatbot.worlds
overworld: MessengerOverworld
max_workers: 30
opt:
debug: True
models:
blender_90M:
... | 503 | 23 | 54 | yml |
null | ParlAI-main/parlai/chat_service/tasks/chatbot/worlds.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.
#
# py parlai/chat_service/tasks/overworld_demo/run.py --debug --verbose
from parlai.core.worlds import World
from parla... | 4,333 | 29.097222 | 96 | py |
null | ParlAI-main/parlai/chat_service/tasks/overworld_demo/__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/parlai/chat_service/tasks/overworld_demo/config.yml | tasks:
echo:
onboard_world: MessengerEchoOnboardWorld
task_world: MessengerEchoTaskWorld
timeout: 180
agents_required: 1
onboard data: # must be the name returned by the overworld
onboard_world: MessengerOnboardDataOnboardWorld
task_world: MessengerOnboardDataTaskWorld
timeout: 180
a... | 743 | 27.615385 | 61 | yml |
null | ParlAI-main/parlai/chat_service/tasks/overworld_demo/worlds.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.worlds import World
from parlai.chat_service.services.messenger.worlds import OnboardWorld
# --------... | 8,536 | 26.990164 | 88 | py |
null | ParlAI-main/parlai/chat_service/tasks/qa_data_collection/__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/parlai/chat_service/tasks/qa_data_collection/config.yml | tasks:
default:
onboard_world: QADataCollectionOnboardWorld
task_world: QADataCollectionTaskWorld
timeout: 300
agents_required: 1
task_name: qa_data_collection
world_module: parlai.chat_service.tasks.qa_data_collection.worlds
overworld: QADataCollectionOverWorld
max_workers: 30
opt:
debug: True
addi... | 372 | 23.866667 | 65 | yml |
null | ParlAI-main/parlai/chat_service/tasks/qa_data_collection/worlds.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.worlds import World, validate
from parlai.chat_service.services.messenger.worlds import (
SimpleMess... | 3,338 | 29.081081 | 86 | py |
null | ParlAI-main/parlai/chat_service/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/parlai/chat_service/utils/config.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.
"""
Config Utils.
"""
import yaml
from collections import namedtuple
WorldConfig = namedtuple(
"WorldConfig",
[... | 2,449 | 32.561644 | 80 | py |
null | ParlAI-main/parlai/chat_service/utils/image.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.
"""
Image-based utils for chat services.
"""
import base64
import io
from typing import Dict, Union
import PIL
import to... | 3,869 | 26.446809 | 87 | py |
null | ParlAI-main/parlai/chat_service/utils/logging.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.
"""
Logging utils for Chat Services.
"""
import logging
import time
#################
# LOGGING UTILS #
################... | 1,066 | 21.702128 | 74 | py |
null | ParlAI-main/parlai/chat_service/utils/misc.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.
"""
Miscellaneous utils for chat services.
"""
import importlib
import math
import re
from enum import Enum
THREAD_MEDIU... | 6,342 | 25.877119 | 88 | py |
null | ParlAI-main/parlai/chat_service/utils/server.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 getpass
import glob
import hashlib
import netrc
import os
import platform
import sh
import shlex
import shutil
im... | 10,239 | 34.068493 | 88 | py |
null | ParlAI-main/parlai/chat_service/utils/timeout.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 time
from typing import List, Optional
from parlai.core.agents import Agent
from parlai.core.message import Messag... | 2,763 | 29.043478 | 91 | py |
null | ParlAI-main/parlai/clib/__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/parlai/clib/cuda/__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/parlai/clib/cuda/ngram_repeat_block_cuda.cpp | /*
Copyright (c) Facebook, Inc. and its affiliates.
Copyright (c) Microsoft Corporation.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
Code adapted from https://github.com/microsoft/fastseq/blob/main/fastseq/clib/cuda/ngram_repeat_block_cuda.cpp.... | 2,000 | 35.381818 | 111 | cpp |
null | ParlAI-main/parlai/core/README.md | The core library contains the following files:
- **agents.py**: this file contains a few basic agents which can be extended by your own model
- **_Agent_**: base class for all other agents, implements the act() method which receives an observation table and returns a table in response
- **_Teacher_**: child of Age... | 3,346 | 91.972222 | 167 | md |
null | ParlAI-main/parlai/core/__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.
"""
Core ParlAI library.
This module contains most of the core abstractions and abstract classes used across all
of Par... | 411 | 28.428571 | 87 | py |
null | ParlAI-main/parlai/core/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.
"""
Common Abstract classes for many agents.
This module provides a set of basic agents:
``Agent(object)``
bas... | 18,269 | 34.338491 | 92 | py |
null | ParlAI-main/parlai/core/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.
"""
Utilities for downloading and building data.
These can be replaced if your particular file system does not support ... | 24,798 | 33.587169 | 140 | py |
null | ParlAI-main/parlai/core/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.
"""
Contains code for parsing and building a dictionary from text.
"""
from typing import Optional
from parlai.core.para... | 29,950 | 34.319575 | 91 | py |
null | ParlAI-main/parlai/core/exceptions.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.
"""
Custom exception classes for ParlAI.
"""
class StopTrainException(Exception):
pass
| 292 | 21.538462 | 65 | py |
null | ParlAI-main/parlai/core/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.
"""
Provide functionality for loading images.
"""
import parlai.core.build_data as build_data
import parlai.utils.loggi... | 9,308 | 35.081395 | 88 | py |