A simple API wrapper for Discord interactions.

Overview
discord-py-interactions

Your ultimate Discord interactions library for discord.py.

About | Installation | Examples | Discord | PyPI

About

What is discord-py-interactions?

discord-py-interactions is, in the simplest terms, a library extension that builds off of the currently existing discord.py API wrapper. While we do use our own basic class code for our own library, a large majority of this library uses discord.py base events in order to make contextualization of interactions relatively easy for us.

When did this begin?

In mid-December of 2020, Discord released the very first type of components, slash commands. These were relatively primitive at the time of their debut, however, over time they slowly came to grew more complex and mutable. This library was created 2 days after the release of slash commands to Discord, and ever since has been actively growing.

What do we currently support?

At this time, we are able to provide you an non-exhaustive list (because Discord are actively creating more interactions at this time) of all components integrated as interactions:

  • Slash Commands
  • Buttons
  • Selects (also known as dropdowns or menus)

Installation

We recommend using pip in order to install our library. You are able to do this by typing the following line below:

pip install -U discord-py-interactions

Examples

Slash Commands

This example shows a very quick and simplistic solution to implementing a slash command.

from discord import Client, Intents, Embed
from discord_slash import SlashCommand, SlashContext

bot = Client(intents=Intents.default())
slash = SlashCommand(bot)

@slash.slash(name="test")
async def test(ctx: SlashContext):
    embed = Embed(title="Embed Test")
    await ctx.send(embed=embed)

bot.run("discord_token")

Cogs

This example serves as an alternative method for using slash commands in a cog instead.

# bot.py
from discord import Intents
from discord.ext.commands import Bot
from discord_slash import SlashCommand

# Note that command_prefix is a required but essentially unused paramater.
# Setting help_command=False ensures that discord.py does not create a !help command.
# Enabling self_bot ensures that the bot does not try and parse messages that start with "!".
bot = Bot(command_prefix="!", self_bot=True, help_command=False, intents=Intents.default())
slash = SlashCommand(bot)

bot.load_extension("cog")
bot.run("discord_token")

# cog.py
from discord import Embed
from discord.ext.commands import Bot, Cog
from discord_slash import cog_ext, SlashContext

class Slash(Cog):
    def __init__(self, bot: Bot):
        self.bot = bot

    @cog_ext.cog_slash(name="test")
    async def _test(self, ctx: SlashContext):
        embed = Embed(title="Embed Test")
        await ctx.send(embed=embed)

def setup(bot: Bot):
    bot.add_cog(Slash(bot))

Buttons

This basic example shows how to easily integrate buttons into your commands. Buttons are not limited to slash commands and may be used in regular discord.py commands as well.

from discord_slash.utils.manage_components import create_button, create_actionrow
from discord_slash.model import ButtonStyle

buttons = [
    create_button(style=ButtonStyle.green, label="A green button"),
    create_button(style=ButtonStyle.blue, label="A blue button")
]
action_row = create_actionrow(*buttons)

await ctx.send(components=[action_row])

Advanced

For more advanced use, please refer to our official documentation on buttons here.

Selects

This basic example shows how to add selects into our bot. Selects offer the same accessibility as buttons do in premise of limitations.

from discord_slash.utils.manage_components import create_select, create_select_option, create_actionrow

select = create_select(
    options=[
        create_select_option("Lab Coat", value="coat", emoji="🥼"),
        create_select_option("Test Tube", value="tube", emoji="🧪"),
        create_select_option("Petri Dish", value="dish", emoji="🧫")
    ],
    placeholder="Choose your option",
    min_values=1, # the minimum number of options a user must select
    max_values=2 # the maximum number of options a user can select
)
action_row = create_actionrow(select)

await ctx.send(components=[action_row])

Advanced

For more advanced use, please refer to our official documentation on selects here.

Context Menus

This basic example shows how to add a message context menu.

from discord_slash.context import MenuContext
from discord_slash.model import ContextMenuType

@slash.context_menu(target=ContextMenuType.MESSAGE,
                    name="commandname",
                    guild_ids=[789032594456576001])
async def commandname(ctx: MenuContext):
    await ctx.send(
        content=f"Responded! The content of the message targeted: {ctx.target_message.content}",
        hidden=True
    )

Advanced

For more advanced use, please refer to our official documentation on context menus here.


Comments
  • [BUG] TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

    [BUG] TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

    Describe the bug message should delete but cannot find id of message Reproducing steps These are the steps I took in order to produce this bug, which should be able to be reproduced for everyone else as well.

    1. Import the module in Python.
    2. Create a client variable for the library.
    3. Try creating a slash command.
    4. send a message
    5. Delete the message
    6. See the traceback error given in the terminal or logger file.

    What's normally expected The message should be deleted

    What actually happened Instead, I received this traceback error given from my Python terminal:

    Traceback (most recent call last):
      File "/root/inter/main.py", line 233, in buy
        await n.delete()
      File "/usr/local/lib/python3.8/dist-packages/interactions/api/models/message.py", line 335, in delete
        message_id=int(self.id), channel_id=int(self.channel_id), reason=reason
    TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
    

    code: https://pastebin.com/qfJU76TF Versions newest unstable wait_for

    bug 
    opened by dontbanmeplz 31
  • refactor: split `_dispatch_event` in two methods

    refactor: split `_dispatch_event` in two methods

    About

    This pull request splits _dispatch_event in two other methods.

    Checklist

    • [x] I've ran pre-commit to format and lint the change(s) made.
    • [x] I've checked to make sure the change(s) work on 3.8.6 and higher.
    • [ ] This fixes/solves an Issue (If existent):.
      • resolves #
    • I've made this pull request for/as: (check all that apply)
      • [x] Documentation
      • [ ] Breaking change
      • [x] New feature/enhancement
      • [ ] Bugfix
    opened by Damego 21
  • Weird issue.

    Weird issue.

    Why am I getting this issue?

    Traceback (most recent call last):
      File "C:\Users\Thomas Keig\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord\client.py", line 333, in _run_event
        await coro(*args, **kwargs)
      File "C:\Users\Thomas Keig\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord_slash\client.py", line 344, in on_socket_response
        await selected_cmd["func"](ctx, *args)
      File "G:/My Drive/Home/Python Projects/Personal/iFBR Bot/Discord Bot/v2.0/bot (only slash cmds).py", line 547, in export
        await ctx.send(embeds=[embed2])
      File "C:\Users\Thomas Keig\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord_slash\model.py", line 111, in send
        resp = await self._http.post(base, self._discord.user.id, self.interaction_id, self.__token, initial)
      File "C:\Users\Thomas Keig\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord_slash\http.py", line 34, in post
        raise RequestFailure(resp.status, await resp.text())
    discord_slash.error.RequestFailure: Request failed with resp: 404 | {"message": "Unknown interaction", "code": 10062}
    
    help wanted 
    opened by thomaskeig 21
  • [REQUEST] Limiting cache

    [REQUEST] Limiting cache

    What is the feature you're proposing? As of right now, caching has no limit. I feel like there should be a way to set a limit for each type of cache, preferably in the Client instance.

    Something like:

    bot = interactions.Client(
        ...,
        cache_limits=interactions.CacheLimits(
            messages=100,
            guilds=50,
            ...
        )
    )
    

    This is the best thing that I can think of off the top of my head. Another way is to ~~do what dis-snek did~~ do something with kwargs and have something like this:

    bot = interactions.Client(
        ...,
        message_cache=100,
        guild_cache=50,
        ...
    )
    

    Additional Information

    • [ ] My feature request is related to an existing Issue.
      • Issue (if referenceable):
    documentation enhancement 
    opened by Toricane 19
  • feat: create basic functionality for Extensions

    feat: create basic functionality for Extensions

    Expands Extension.new and adds new functions to mimic client decorators

    About

    This pr adds in basic functionality for the Extension class, along with decorators for commands/components/listeners Marked as a draft because some things are missing, like properly removing commands on removal of the Extension Any suggestions on improvements are welcome

    Checklist

    • [ ] I've ran pre-commit to format and lint the change(s) made.
    • [x] I've checked to make sure the change(s) work on 3.8.6 and higher.
    • [x] This fixes/solves an Issue.
    • [x] I've made this pull request for/as: (check all that apply)
      • [ ] Documentation
      • [ ] Breaking change
      • [x] New feature/enhancement
      • [ ] Bugfix
    documentation enhancement pending breaking priority 
    opened by Catalyst4222 19
  • Slash command greyed out even though I have permission

    Slash command greyed out even though I have permission

    I created a simple bot with this module, and I believe this is a bug. I was working with this bot, everything working normally, when suddenly my permission based commands were greyed out. I can't pinpoint the exact change that caused the issue, but it happened when I added a command I think. I'm still in the process of debugging, but believe this is a bug. What I have tried:

    • [x] Deleting the commands
    • [x] Unloading the cog
    • [x] Deleting all slash commands
    • [x] Restarting the bot
    • [x] Using a different bot

    Let me know if I should try any new debugging steps

    opened by zurgeg 19
  • Add Application Permissions Support

    Add Application Permissions Support

    About this pull request

    Adds support for the slash command permissions. I wanted it for my own bot, got it into a workable state, so I figure I can open a PR to add its feature for everyone if accepted. Feel free to review and test. Let me know of any feedback, happy to accept critics and improve the code 😄.

    Changes

    • Add setting of default_permission and permissions option for slash command.
    • Add get_all_command_permissions and put_command_permissions method to http module.
    • Add support for storing permission data in CommandObject.
    • Add create_guild_permissions and create_permission utils method to facility defining permissions.
    • Add PermissionsData class used for checking for any permission updates since last sync, similar to how CommandData works.
    • Add logic to registers permissions in the sync_all_commands method.
    • Add SlashCommandPermissionsType enum class to match discord api's ApplicationCommandPermissionType.
    • Add relevant documentation needed for the code changes.

    Example decorator with subcommand:

    @slash.subcommand(
        guild_ids=[750556940127436880, 823454213089787914],
        base="test", 
        base_desc="test",  
        subcommand_group="group",
        sub_group_desc="group",
        name="sub",
        description="sub"
    )
    @slash.permission(823454213089787914, generate_permissions(allowed_roles=[823851472982376468, 823851440232857600]))
    @slash.permission(750556940127436880, generate_permissions(allowed_roles=[778838673666998292]))
    async def test_sub(ctx):
        await ctx.send("test_sub")
    

    Checklist

    • [ ] I've checked this pull request runs on Python 3.6.X.
    • [ ] This fixes something in Issues.
      • Issue:
    • [x] This adds something new.
    • [x] There is/are breaking change(s).
    • [x] (If required) Relevant documentation has been updated/added.
    • [ ] This is not a code change. (README, docs, etc.)
    enhancement priority 
    opened by benwoo1110 17
  • Auto delete could potentially make a lot of requests

    Auto delete could potentially make a lot of requests

    The Problem

    Currently if auto_delete is True a GET request will be made for every guild the bot is in on every load. This could potentially cause thousands of requests (depending on the size of the bot) and discord has indicated that they might be introducing rate limits for slash commands. This could make the library unusable for some.

    Proposed solution

    Add a check_all_guilds parameter to SlashCommand which defaults to False. If it's false then check all guilds that have commands registered to them, don't check all guilds. If it's true check all guilds (like currently), possibly add a WARNING if guilds above a certain number.

    The only problem I can see with this is that it won't delete commands in a guild if there are no commands registered to that guild in SlashCommand

    Possible alternatives

    • Proposed solution above but default to False
    • Proposed solution above but require it
    • Leave it as is, causing high traffic at startup for large bots, and possibly reaching rate limits
    • The ideal solution would be an endpoint that could be used to get all guilds with commands currently. There's an issue on the discord repo but no one has responded yet
    help wanted 
    opened by AnotherCat 15
  • refactor!: use `attrs.asdict` as a way to get json data of the object

    refactor!: use `attrs.asdict` as a way to get json data of the object

    About

    This pull request:

    1. Makes DictSerializerMixin._json as a property with using attrs.asdict to get json data of the object.
    2. Solves all troubles with editing json. You don't need to edit json anymore lol.
    3. Removes ComponentMixin and json modifing in a lot of objects like Embed.
    4. Limited using _json property in some places: using walrus operators and objects instead of dicts(wsclient).
    5. Removes outdated(since attrs added) code like here

    Checklist

    • [x] The pre-commit code linter has been run over all edited files to ensure the code is linted.
    • [x] I've ensured the change(s) work on 3.8.6 and higher.

    I've made this pull request: (check all that apply)

    • [ ] For the documentation
    • [ ] To add a new feature
    • [x] As a general enhancement
    • [x] As a refactor of the library/the library's code
    • [ ] To fix an existing bug
    • [ ] To resolve #ISSUENUMBER

    This is:

    • [x] A breaking change
    enhancement 
    opened by Damego 14
  • fix!: fix ``guilds`` property in client

    fix!: fix ``guilds`` property in client

    About

    Fixes an error occurring because of the cached guild object already having an HTTPClient

    Checklist

    • [x] I've ran pre-commit to format and lint the change(s) made.
    • [x] I've checked to make sure the change(s) work on 3.8.6 and higher.
    • [x] This fixes/solves an Issue.
      • (If existent): #664
    • [ ] I've made this pull request for/as: (check all that apply)
      • [ ] Documentation
      • [ ] Breaking change
      • [ ] New feature/enhancement
      • [x] Bugfix
    opened by EdVraz 12
  • Heartbeat dropping crashes the bot until manually restarted

    Heartbeat dropping crashes the bot until manually restarted

    This has been discussed in the Discord server, but I thought I'd file an issue for the sake of completeness.

    When a bot can't get a heartbeat, there's no connection logic to reconnect the bot afterwards. This means that bots, even on stable connections (I'm using a Contabo VPS), can have trouble staying online for any extended period of time.

    For now, as a bodge, I'm testing using GNU timeout to restart my bot by force as a pre-emptive measure - if anyone wants the shell script, let me know

    bug 
    opened by dxf 12
  • [BUG] Error starting when using scope param in command decorator

    [BUG] Error starting when using scope param in command decorator

    Describe the bug.

    When starting the bot with a command that has a scope as a param specified it results in a KeyError:

    Could not prepare the client:
    Traceback (most recent call last):
      File "----/venv/lib/python3.10/site-packages/interactions/client/bot.py", line 404, in _ready
        await self.__sync()
      File "----/venv/lib/python3.10/site-packages/interactions/client/bot.py", line 621, in __sync
        if _guild_command["name"] not in __check_guild_commands[_guild_id]:
    KeyError: None
    

    List the steps.

    1. Create a bot:
    ids = 8210301307------
    bot = interactions.Client(token="", default_scope=ids)
    
    1. Create a command with a scope param:
    @bot.command(
        name="test",
        description="test",
        scope=ids
    )
    async def _test(ctx):
        await ctx.send("test")
    
    
    1. run the bot
    2. see Traceback

    What you expected.

    The command should be correctly registered for the guilds provided in the default_scope and command scope

    File client/bot.py, line 517, in __resolve_commands:

    if cmd.default_scope and self._default_scope:
        cmd.scope = (
            cmd.scope.extend(self._default_scope)
            if isinstance(cmd.scope, list)
            else self._default_scope
        )
    

    cmd.scope.extend(self._default_scope) extends the cmd.scope, but then sets cmd.scope to its return value, which is None. This overrides the scope, resulting in None being passed as the scope to command in full_data. This passes None as the guild_id to the ApplicationCommand, which is used in when getting a guild_commands _guild_id => KeyError here if _guild_command["name"] not in __check_guild_commands[_guild_id]:

    replace

    if cmd.default_scope and self._default_scope:
      cmd.scope = (
          cmd.scope.extend(self._default_scope)
          if isinstance(cmd.scope, list)
          else self._default_scope
      )
    

    with

    if cmd.default_scope and self._default_scope:
      if isinstance(cmd.scope, list):
        cmd.scope.extend(self._default_scope)
      else:
        cmd.scope = self._default_scope
    

    What you saw.

    Instead, I received this traceback error given from my Python terminal:

    Could not prepare the client:
    Traceback (most recent call last):
      File "----/venv/lib/python3.10/site-packages/interactions/client/bot.py", line 404, in _ready
        await self.__sync()
      File "----/venv/lib/python3.10/site-packages/interactions/client/bot.py", line 621, in __sync
        if _guild_command["name"] not in __check_guild_commands[_guild_id]:
    KeyError: None
    

    What version of the library did you use?

    stable

    Version specification

    4.3.4

    Code of Conduct

    • [X] I agree to follow the contribution requirements.
    bug 
    opened by H3rmt 1
  • fix(attrs): add factory value to interaction resolved data

    fix(attrs): add factory value to interaction resolved data

    About

    This pull request fixes error from this thread Tested locally:

    from interactions import InteractionResolvedData
    
    data = InteractionResolvedData()
    print("a" in data.members)
    

    Checklist

    • [ ] The pre-commit code linter has been run over all edited files to ensure the code is linted.
    • [ ] I've ensured the change(s) work on 3.8.6 and higher.

    I've made this pull request: (check all that apply)

    • [ ] For the documentation
    • [ ] To add a new feature
    • [ ] As a general enhancement
    • [ ] As a refactor of the library/the library's code
    • [x] To fix an existing bug
    • [ ] To resolve #ISSUENUMBER

    This is:

    • [ ] A breaking change
    bug 
    opened by Damego 0
  • refactor!: Change type of permissions attrs to `Permissions`

    refactor!: Change type of permissions attrs to `Permissions`

    About

    This pull request changes the type of permissions attribute of the most dataclasses to Permissions type. Case when you can't change perms for Overwrite Additionally fixes wrong check for type parameter in Channel.add_permission_overwrite.

    Checklist

    • [x] The pre-commit code linter has been run over all edited files to ensure the code is linted.
    • [x] I've ensured the change(s) work on 3.8.6 and higher.

    I've made this pull request: (check all that apply)

    • [ ] For the documentation
    • [ ] To add a new feature
    • [x] As a general enhancement
    • [x] As a refactor of the library/the library's code
    • [x] To fix an existing bug
    • [ ] To resolve #ISSUENUMBER

    This is:

    • [x] A breaking change
    bug enhancement 
    opened by Damego 2
  • feat: Add support for age-restricted commands

    feat: Add support for age-restricted commands

    About

    Title.

    Checklist

    • [x] The pre-commit code linter has been run over all edited files to ensure the code is linted.
    • [x] I've ensured the change(s) work on 3.8.6 and higher.

    I've made this pull request: (check all that apply)

    • [ ] For the documentation
    • [x] To add a new feature
    • [x] As a general enhancement
    • [ ] As a refactor of the library/the library's code
    • [ ] To fix an existing bug
    • [ ] To resolve #ISSUENUMBER

    This is:

    • [ ] A breaking change
    enhancement 
    opened by Damego 0
  • feat: Add helpers for role connection

    feat: Add helpers for role connection

    About

    This pull request implements helper methods for new role connection feature.

    Checklist

    • [x] The pre-commit code linter has been run over all edited files to ensure the code is linted.
    • [x] I've ensured the change(s) work on 3.8.6 and higher.

    I've made this pull request: (check all that apply)

    • [ ] For the documentation
    • [x] To add a new feature
    • [ ] As a general enhancement
    • [ ] As a refactor of the library/the library's code
    • [ ] To fix an existing bug
    • [ ] To resolve #ISSUENUMBER

    This is:

    • [ ] A breaking change
    enhancement 
    opened by Damego 0
  • feat: Implement own `IntEnum` & `StrEnum`

    feat: Implement own `IntEnum` & `StrEnum`

    About

    There are cases when unknown enum value brokes whole bot.

    For example:

    Websocket have raised an exception, closing.
    Traceback (most recent call last):
      File "D:\python_gh\discord_bots\ipy_bot\venv\Lib\site-packages\interactions\client\bot.py", line 479, in _login
        await self._websocket.run()
      File "D:\python_gh\discord_bots\ipy_bot\venv\Lib\site-packages\interactions\api\gateway\client.py", line 304, in run
        await self._handle_stream(msg)
      File "D:\python_gh\discord_bots\ipy_bot\venv\Lib\site-packages\interactions\api\gateway\client.py", line 356, in _handle_stream
        self._dispatch_event(event, data)
      File "D:\python_gh\discord_bots\ipy_bot\venv\Lib\site-packages\interactions\api\gateway\client.py", line 374, in _dispatch_event
        self._dispatch_discord_event(event, data)
      File "D:\python_gh\discord_bots\ipy_bot\venv\Lib\site-packages\interactions\api\gateway\client.py", line 493, in _dispatch_discord_event
        obj = model(**data)
              ^^^^^^^^^^^^^
      File "D:\python_gh\discord_bots\ipy_bot\venv\Lib\site-packages\interactions\utils\attrs_utils.py", line 144, in __init__
        super().__init__(**kwargs)
      File "D:\python_gh\discord_bots\ipy_bot\venv\Lib\site-packages\interactions\utils\attrs_utils.py", line 80, in __init__
        self.__attrs_init__(**passed_kwargs)  # type: ignore
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<attrs generated init interactions.api.models.message.Message>", line 21, in __attrs_init__
        self.type = __attr_converter_type(type)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\python_gh\discord_bots\ipy_bot\venv\Lib\site-packages\attr\converters.py", line 39, in optional_converter
        return converter(val)
               ^^^^^^^^^^^^^^
      File "D:\python_gh\discord_bots\ipy_bot\venv\Lib\site-packages\interactions\utils\attrs_utils.py", line 205, in inner_convert_object
        return value if isinstance(value, type_) else type_(value)
                                                      ^^^^^^^^^^^^
      File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\enum.py", line 695, in __call__
        return cls.__new__(cls, value)
               ^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\enum.py", line 1111, in __new__
        raise ve_exc
    ValueError: 0 is not a valid MessageType
    
    Process finished with exit code 0
    

    This pr fixes this error by implementing own enum for int and str types and adding _missing_ method for catching unknown values.

    Code:

    @client.event
    async def on_message_create(message: interactions.Message):
        print(message.type, type(message.type))
    

    Result:

    MessageType.UNKNOWN: 0 <enum 'MessageType'>
    

    Checklist

    • [x] The pre-commit code linter has been run over all edited files to ensure the code is linted.
    • [x] I've ensured the change(s) work on 3.8.6 and higher.

    I've made this pull request: (check all that apply)

    • [ ] For the documentation
    • [x] To add a new feature
    • [ ] As a general enhancement
    • [ ] As a refactor of the library/the library's code
    • [x] To fix an existing bug
    • [ ] To resolve #ISSUENUMBER

    This is:

    • [ ] A breaking change
    bug enhancement 
    opened by Damego 0
Releases(4.4.0-beta.1)
Owner
james
"King" of interactions. I like to wear different hats for parties. fl0w#0001
james
The code for our CVPR paper PISE: Person Image Synthesis and Editing with Decoupled GAN, Project Page, supp.

PISE The code for our CVPR paper PISE: Person Image Synthesis and Editing with Decoupled GAN, Project Page, supp. Requirement conda create -n pise pyt

jinszhang 110 Nov 21, 2022
Code for our ICCV 2021 Paper "OadTR: Online Action Detection with Transformers".

Code for our ICCV 2021 Paper "OadTR: Online Action Detection with Transformers".

66 Dec 15, 2022
Generate Contextual Directory Wordlist For Target Org

PathPermutor Generate Contextual Directory Wordlist For Target Org This script generates contextual wordlist for any target org based on the set of UR

8 Jun 23, 2021
Objective of the repository is to learn and build machine learning models using Pytorch. 30DaysofML Using Pytorch

30 Days Of Machine Learning Using Pytorch Objective of the repository is to learn and build machine learning models using Pytorch. List of Algorithms

Mayur 119 Nov 24, 2022
商品推荐系统

商品top50推荐系统 问题建模 本项目的数据集给出了15万左右的用户以及12万左右的商品, 以及对应的经过脱敏处理的用户特征和经过预处理的商品特征,旨在为用户推荐50个其可能购买的商品。 推荐系统架构方案 本项目采用传统的召回+排序的方案。

107 Dec 29, 2022
Simple tools for logging and visualizing, loading and training

TNT TNT is a library providing powerful dataloading, logging and visualization utilities for Python. It is closely integrated with PyTorch and is desi

1.5k Jan 02, 2023
A lightweight Python-based 3D network multi-agent simulator. Uses a cell-based congestion model. Calculates risk, loudness and battery capacities of the agents. Suitable for 3D network optimization tasks.

AMAZ3DSim AMAZ3DSim is a lightweight python-based 3D network multi-agent simulator. It uses a cell-based congestion model. It calculates risk, battery

Daniel Hirsch 13 Nov 04, 2022
Code for our EMNLP 2021 paper “Heterogeneous Graph Neural Networks for Keyphrase Generation”

GATER This repository contains the code for our EMNLP 2021 paper “Heterogeneous Graph Neural Networks for Keyphrase Generation”. Our implementation is

Jiacheng Ye 12 Nov 24, 2022
Discerning Decision-Making Process of Deep Neural Networks with Hierarchical Voting Transformation

Configurations Change HOME_PATH in CONFIG.py as the current path Data Prepare CENSINCOME Download data Put census-income.data and census-income.test i

2 Aug 14, 2022
PyTorch reimplementation of the paper Involution: Inverting the Inherence of Convolution for Visual Recognition [CVPR 2021].

Involution: Inverting the Inherence of Convolution for Visual Recognition Unofficial PyTorch reimplementation of the paper Involution: Inverting the I

Christoph Reich 100 Dec 01, 2022
On the model-based stochastic value gradient for continuous reinforcement learning

On the model-based stochastic value gradient for continuous reinforcement learning This repository is by Brandon Amos, Samuel Stanton, Denis Yarats, a

Facebook Research 46 Dec 15, 2022
RANZCR-CLiP 7th Place Solution

RANZCR-CLiP 7th Place Solution This repository is WIP. (18 Mar 2021) Installation git clone https://github.com/analokmaus/kaggle-ranzcr-clip-public.gi

Hiroshechka Y 21 Oct 22, 2022
Train Dense Passage Retriever (DPR) with a single GPU

Gradient Cached Dense Passage Retrieval Gradient Cached Dense Passage Retrieval (GC-DPR) - is an extension of the original DPR library. We introduce G

Luyu Gao 92 Jan 02, 2023
A set of tools to pre-calibrate and calibrate (multi-focus) plenoptic cameras (e.g., a Raytrix R12) based on the libpleno.

COMPOTE: Calibration Of Multi-focus PlenOpTic camEra. COMPOTE is a set of tools to pre-calibrate and calibrate (multifocus) plenoptic cameras (e.g., a

ComSEE - Computers that SEE 4 May 10, 2022
This is the official PyTorch implementation of our paper: "Artistic Style Transfer with Internal-external Learning and Contrastive Learning".

Artistic Style Transfer with Internal-external Learning and Contrastive Learning This is the official PyTorch implementation of our paper: "Artistic S

51 Dec 20, 2022
[AAAI-2021] Visual Boundary Knowledge Translation for Foreground Segmentation

Trans-Net Code for (Visual Boundary Knowledge Translation for Foreground Segmentation, AAAI2021). [https://ojs.aaai.org/index.php/AAAI/article/view/16

ZJU-VIPA 2 Mar 04, 2022
[NeurIPS-2021] Slow Learning and Fast Inference: Efficient Graph Similarity Computation via Knowledge Distillation

Efficient Graph Similarity Computation - (EGSC) This repo contains the source code and dataset for our paper: Slow Learning and Fast Inference: Effici

24 Dec 31, 2022
AugLy is a data augmentations library that currently supports four modalities (audio, image, text & video) and over 100 augmentations

AugLy is a data augmentations library that currently supports four modalities (audio, image, text & video) and over 100 augmentations. Each modality’s augmentations are contained within its own sub-l

Facebook Research 4.6k Jan 09, 2023
Official implementation of Neural Bellman-Ford Networks (NeurIPS 2021)

NBFNet: Neural Bellman-Ford Networks This is the official codebase of the paper Neural Bellman-Ford Networks: A General Graph Neural Network Framework

MilaGraph 136 Dec 21, 2022
make ASCII Art by Deep Learning

DeepAA This is convolutional neural networks generating ASCII art. This repository is under construction. This work is accepted by NIPS 2017 Workshop,

OsciiArt 1.4k Dec 28, 2022