text
stringlengths
1
93.6k
"pin": "تثبيت 📌",
"unpin": "الغاء تثبيت 📌",
"ban": "العضو [{}](tg://user?id={}) تم حظره ❌",
"ban_id": "العضو {} تم حظره",
"banError": "العضو غير محظور 🙄",
"muteError": "العضو ليس مكتوم 🙄",
"admins": {
"0": "لا يوجد مشرفين ❌",
"1": "👤 المدير : {}\nالمشرفين :\n{}"
},
"filter": "☠️ تم اضافة الكلمة لقائمة الكلمات المحظورة :\n{}",
"unfilter": "☠️ تم ازالة الكلمة من قائمة الكلمات المحظورة :\n{}",
"filters": "🤐 الكلمات المحظورة :\n{}",
"mute": "العضو [{}](tg://user?id={}) تم اضافته لقائمة المكتومين لمدة {} يوم",
"unmute": "تم الغاء الكتم :)",
"muteAll": {
"0": "تم قفل المجموعة ✅",
"1": "المجموعة مقفلة مسبقا ✅"
},
"unmuteAll": {
"0": "تم فتح المجموعة ✅",
"1": "المجموعة غير مقفلة ✅"
},
"admins_set": ""
},
"admin": {
"add": {
"0": "المجموعة مفعلة مسبقا 🔖",
"1": "تم تفعيل البوت في المجموعة ✅"
},
"rem": {
"0": "تم ازالة البوت من المجموعة 💢",
"1": "المجموعة ليست مفعلة 💢"
}
},
"who": {
"name": "👤 *{} {}*",
"group": "👥 *{}*",
"id": "🆔 \\[{}]",
"username": "▶️ @{}"
}
}
}
# <FILESEP>
# Copyright 2023 NNAISENSE SA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import torch
import functools
from abc import abstractmethod
from torch.distributions.normal import Normal
from torch.distributions.categorical import Categorical as torch_Categorical
from torch.distributions.bernoulli import Bernoulli as torch_Bernoulli
from torch.distributions.mixture_same_family import MixtureSameFamily
from torch.distributions.uniform import Uniform
from math import log
from utils_model import (
safe_exp,
safe_log,
idx_to_float,
float_to_idx,
quantize, sandwich,
)
class CtsDistribution:
@abstractmethod
def log_prob(self, x):
pass
@abstractmethod
def sample(self):
pass
class DiscreteDistribution:
@property
@abstractmethod
def probs(self):
pass
@functools.cached_property
def log_probs(self):
return safe_log(self.probs)