Saravanan666/pypi-org huggingface dataset:
Package: self-certifi
1Self-certifiVersion:1.0.0Source:https://github.com/maykinmedia/self-certifiKeywords:requests, certifi, self-signed, certificatesPythonVersion:3.7Create a CA-bundle based oncertifiand self-signed certificates, for usage withrequests.Contents1Self-certifi2Features3Installation3.1Requirements3.2Install4Usage2FeaturesKeep originalcertifiCA-bundleAdd your own custom/self-signed (root) certificatesConfiguration via environment variable3Installation3.1RequirementsPython 3.7 or newersetuptools 30.3.0 or above3.2Installpipinstallself-certifi4Usagefromself_certifiimportload_self_signed_certsload_self_signed_certs("/path/to/installation/directory")
Package: selfcheckgpt
Code for our paper “SelfCheckGPT: Zero-Resource Black-Box Hallucination Detection for Generative Large Language Models”,https://arxiv.org/abs/2303.08896More information can be found on our project page:https://github.com/potsawee/selfcheckgptInstallationpip install selfcheckgptSelfCheckGPT UsageSee more details in Jupyter Notebook:https://github.com/potsawee/selfcheckgpt/blob/main/demo/SelfCheck_demo1.ipynbfromselfcheckgpt.modeling_selfcheckimportSelfCheckMQAG,SelfCheckBERTScoreselfcheck_mqag=SelfCheckMQAG()selfcheck_bertscore=SelfCheckBERTScore()sent_scores_mqag=selfcheck_mqag.predict(sentences,passage,[sample1,sample2,sample3],num_questions_per_sent=5,scoring_method='bayes_with_alpha',beta1=0.8,beta2=0.8,)sent_scores_bertscore=selfcheck_bertscore.predict(sentences,[sample1,sample2,sample3],)MQAG UsageSee more details in Jupyter Notebook:https://github.com/potsawee/selfcheckgpt/blob/main/demo/MQAG_demo1.ipynbfromselfcheckgpt.modeling_mqagimportMQAGmqag_model=MQAG()
Package: self-checking-algorith-model
A sample Python projectA sample project that exists as an aid to thePython Packaging User
Guide'sTutorial on Packaging and Distributing
Projects.This project does not aim to cover best practices for Python project
development as a whole. For example, it does not provide guidance or tool
recommendations for version control, documentation, or testing.The source for this project is available here.Most of the configuration for a Python project is done in thesetup.pyfile,
an example of which is included in this project. You should edit this file
accordingly to adapt this sample project to your needs.This is the README file for the project.The file should use UTF-8 encoding and can be written usingreStructuredTextormarkdownwith the appropriatekey set. It will be used to generate the project webpage on PyPI and will be
displayed as the project homepage on common code-hosting services, and should be
written for that purpose.Typical contents for this file would include an overview of the project, basic
usage examples, etc. Generally, including the project changelog in here is not a
good idea, although a simple “What's New” section for the most recent version
may be appropriate.
Package: selfcontain
Make HTML more self-contained by in-lining:JavaScript (minified)CSS (minified)Images (base-64 encoded)Including (explicitly linked) faviconsFor straightforward cases, this will take an HTML document which might
have external dependencies and return an HTML document with no
external dependencies - a single self-contained file that you could
send as an email attachment, or show as a presentation without
worrying about internet connectivity, for example.Cases that arenotstraightforward are those that involve loading
things via JavaScript,iframethings, fonts, and things I haven’t
thought of. Pull requests welcome!UsageLoaded as a module,selfcontain()takes an HTML string and base
path or URL and is the main function to know. Command-line usage wraps
the minor extensionselfcontain_ref(), which takes a string
specifying a file path or URL to fetch and process:selfcontain test_in.html > test_out.html
# or
selfcontain https://raw.githubusercontent.com/ajschumacher/selfcontain/master/test_in.html > test_out.html
Package: selfcord
selfcordThe best Discord selfbot API wrapper.
Enhances discord.py selfbots with new functions.Edit your Discord client settings, account settings and more with code.Exampleimportdiscordimportselfcordfromdiscord.extimportcommandsbot=commands.Bot(command_prefix=".",self_bot=True)selfcord.login("TOKEN")@bot.eventasyncdefon_ready():print("Selfcord Example Selfbot Online.")print("Use the prefix '.' to control the bot")@bot.command(name="changetheme",usage="[light/dark]")asyncdefchangetheme(ctx,theme):selfcord.User.setTheme(theme)selfcord.Messages.sendMessage(f"Changed your Discord client theme to `{theme}`.",ctx.channel.id)@bot.command(name="customstatus",usage="[text]")asyncdefcustomstatus(ctx,*,text):selfcord.User.setCustomStatus(text)selfcord.Messages.sendMessage(f"Changed your Discord custom status to `{text}`.",ctx.channel.id)bot.run("TOKEN",bot=False)
Package: selfcord.py
SELFCORDA Powerful Library for Discord SelfbotsFeautresModern Pythonic API usingasync/awaitsyntaxEasy to use with an object oriented designOptimised for both speed and memoryPrevents detection of user account automationMulti-token supportClean Documentation (not real)Community SupportInstallationPython 3.10 or higher is required.pip install selfcord.pyWikiRead ourWikiin regards to documentation and getting started.Getting StartedA selfbot that responds to a message ("ping!") with another message ("pong").importselfcordtoken="insert token"bot=selfcord.Bot()@bot.on("ready")asyncdefready(time):print(f"Connected To{bot.user.name}\nStartup took{time:0.2f}seconds")@bot.on("message")asyncdefresponder(message):ifmessage.content=="ping!":awaitmessage.channel.send("pong!")bot.run(token)Examples/UsageMessage loggerIn this snippet, If someone deletes messages in the server, it records details such as the server name, channel name, message content, and the author's nameimportselfcordtoken="insert token"bot=selfcord.Bot(prefixes=["!","?"])@bot.on("ready")asyncdefball(time):print(f"Connected To{bot.user}\nStartup took{time:0.2f}seconds")@bot.on("message_delete")asyncdefmessage_logger(message):# DISCLAIMER: If message is not in bots cache only message id, channel id and guild id will be presentifmessage.author!=None:ifmessage.author.id!=bot.user.id:ifmessage.guild!=None:# If the message is in a guildawaitaprint(f"""MESSAGE LOGGED:SERVER:{message.guild.name}CHANNEL:{message.channel.name}CONTENT:{message.author}:{message.content}""")else:# If the message is in a DM or Group chatawaitaprint(f"""MESSAGE LOGGED:CHANNEL:{message.channel}CONTENT:{message.author}:{message.content}""")bot.run(token)Purge commandIn this snippet, you are able to delete certain amount of messages from a channelimportselfcordtoken="insert token"bot=selfcord.Bot(prefixes=["!","?"])@bot.on("ready")asyncdefball(time):print(f"Connected To{bot.user}\nStartup took{time:0.2f}seconds")@bot.cmd(description="Purges the channel",aliases=["wipe","clear"])asyncdefpurge(ctx,amount:int=None):awaitctx.purge(amount)bot.run(token)Deleted message sniperIn this snippet, you can retrieve the most recently deleted message.importselfcordtoken="insert token"bot=selfcord.Bot(prefixes=["!","?"])@bot.on("ready")asyncdefball(time):print(f"Connected To{bot.user}\nStartup took{time:0.2f}seconds")@bot.cmd(description="Snipe",aliases=['s'])asyncdefsnipe(ctx):awaitctx.reply(f"{bot.user.deleted_messages[-1].author}:{bot.user.deleted_messages[-1]}")bot.run(token)Captcha2Captchais the only captcha solving service supported currently.Some Useful LinksDocumentationOther Documentation (messy)PyPiOfficial Discord ServerA simple selfbot designed to showcase the library's featuresContributingContributors are always Welcome
Package: self-designed-NeuralNetwork
AboutThis is a self-designed deep learning framework created by victor @HangzhouFeaturesDefine Dynamic Computing GraphDefine Neural Network Operatordefine Linear, Sigmoid, L2_lossAuto_Diff ComputingAuto-Feedforward and BackwardRemainClassificaitonCross-EntropyCNN, RNNConnectionwhatchat:alwayslearn
Mail:2534535@qq.com
Package: selfdiffusion
selfdiffusionselfdiffusion is a CLI tool that helps you prepare training datasets ofportraitimages forstable diffusionmodel
fine tuning.selfdiffusion takes as input images of different sizes and uses an empirical
heuristic to extract the subject of the image and create a version of it that
fits the native resolution of the model you want to fine-tune.Getting startedinstall the CLI tool with pip:pipinstallselfdiffusionUsageStart by assembling a set of images that contains the single subject you want
to fine tune the model on. If you don't have such a
dataset, we provide the utiliy bing command to download images from the internet into a target folder:selfdiffusionbing"portrait of a person"--target/path/to/target/folder--limit20this will download 20 images of people from bing and store them in the /path/to/target/folder.Once you have your starting images, extract portraits suitable for fine tuning with the following command:# 512x512 is ideal for fine-tuning runwayml/stable-diffusion-v1-5selfdiffusionperson/path/to/input/images/path/to/output/images--resolution512512you can find out more about model fine tuning in the exemples folder of thediffusersrepository.Notesselfdiffusion will produce an output image for every input image given that:The input image as a resolution that is greater then the requested output resolution in both dimensions.There is a single person in your image, as determined byyolov8and it's face is the only one in the image, as determined byface_recognition.Sometimes, selfdiffusion will filter out an image that very evidently
contains a single subject and it's face. If you absolutely want to have this image in your dataset, we suggest using a tool likeBirmefor capturing the subject and resizing to the native model resolution.AuthorJonathan Pelletier.
Package: self-discover
Self DiscoverSelf Discover serves autodiscover (Outlook) and autoconfig (Thunderbird) XML files for mail auto-configuration.InstallGenericRun the following command to create a source distribution:python3 setup.py sdistPyPIRun the following command to install the package from PyPI:pip3 install self-discoverConfigurePass the following environment variables:IMAP_SERVER_HOSTNAMEPOP3_SERVER_HOSTNAMESMTP_SERVER_HOSTNAMEUsageRun the app using an ASGI server such as Uvicorn.TestsRun tests with pytest:pytest tests/
Package: self-documenting-struct
Most projects that use thestructlibraryuse raw format strings, which are difficult to understand and remember. This library intuitively wraps thestructlibrary to address this issue. provides dataclasses that define the variousstructformat string elements, which can then be combined into format strings in a far more consistent and self-documenting manner than they could otherwise.I wrote this library to aid my reverse engineering efforts.On a practical level, I grew tired of copy-pasting unintuitivestructformat strings for common data types like integers and C strings.On a philosophical level, I believe read-time convenience should be favored above write-time convenience - especially for code that documents file formats.Old-stylestructformat stringSelf-documentingstruct'<H'f'{Type.uint16_le}''hhl'f'{Primitive.short}{Primitive.short}{Primitive.long}''<10sHHb'f'{ByteOrder.little}10{Primitive.fixed_length_string}2{Primitive.ushort}{Primitive.bool}'Some simple data types are provided as a sample, with read/write helper functions. Thestructlibrary methods are still available, but they are renamed as "raw" methods:Old-stylestructmethodSelf-documentingstructmethodstruct.packself_documenting_struct.pack.rawstruct.pack_intoself_documenting_struct.pack.raw_intostruct.unpackself_documenting_struct.unpack.rawstruct.unpack_fromself_documenting_struct.unpack.raw_fromstruct.iter_unpackself_documenting_struct.unpack.iter_rawstruct.calcsizeself_documenting_struct.calcsizeExample UsageYou can unpack and pack with the existing simple data types already provided for you.importself_documenting_structasstructwithopen('C:\WINDOWS\BEAR.EXE','rb')asbear_file:# Since this contains just one element, the tuple is automatically unpacked# by the uint32_le method.## More readable than struct.unpack_from('<I', bear_file)[0].an_integer:int=struct.unpack.uint32_le(bear_file)withopen('C:\WINNT\BUNNY32.DLL','wb')asbunny_file:a_packed_integer:bytes=struct.pack.unt32_le(an_integer)bunny_file.write(a_packed_integer)Or you can self-documentingly define your own data types using theByteOrder,Primitive, andTypedataclasses.
(ThePrimitivedataclass names individual format characters, and theTypedataclass contains common compositions ofByteOrdersPrimitives.)importself_documenting_structasstructfromself_documenting_struct.data_typesimportPrimitive,Type# This is much more readable than "<Hx?".foo_bar_type_string:str=f'{Type.uint16_le}{Primitive.pad_byte}{Primitive.bool}'withopen('C:\WINDOWS\BEAR.EXE','rb')asbear_file:# Creates a tuple with the given elements.# Like usual, you must access the tuple yourself.foo_bar_int,_,foo_bar_bool=struct.unpack.raw_from(foo_bar_type_string,bear_file)withopen('C:\WINNT\BUNNY32.DLL','wb')asbunny_file:struct.raw_into(foo_bar_type_string,foo_bar)And, of course, you can define a custom module that extends the self-documenting functionality to your own types.TODOsAdd native support for more simple data types useful for reverse engineering.Add support for theStructobject.
Package: selfext
# SelfExt[![Build](https://api.travis-ci.org/kazukazuprogram/selfext.svg?branch=master)](https://travis-ci.org/kazukazuprogram/selfext/)## A Python library that generates self-extracting Python script.- ### How to Use- Install```pip install git+https://github.com/kazukazuprogram/selfext```- To generate a self-extracting script,```import selfextselfext.gen(compdir, outfile)```compdir : Compression source directoryoutfile : Name of generated file
Package: selfextend
SelfExtendAttnImplementation of SelfExtendAttn from the paper "LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuning" from Pytorch and Zeta. This implementation is based mostly on the pseudocode listed in Algorithm 1 in page 4Installpip install selfextendUsageimporttorchfromse_attnimportSelfExtendAttn# Example usagedim=512# Dimension of modelg_size=2# Group sizew_size=4# Window size for neighbor tokensself_extend=SelfExtendAttn(dim,g_size,w_size,qk_norm=True)# Example tensors for q, k, v, and posq=torch.randn(1,10,dim)k=torch.randn(1,10,dim)v=torch.randn(1,10,dim)pos=torch.arange(0,10).unsqueeze(0)# Example positional indicesoutput=self_extend(q,k,v,pos)print(output)Technical ArchitectureKey ConceptsGrouped Attention: This mechanism divides the input sequence into groups and applies the attention operation within each group. It uses a floor operation to adjust the positions within the groups, enabling efficient handling of longer sequences.Normal Attention: Standard self-attention used in transformers, focusing on nearby tokens within a specified window.Attention MechanismTheSelfExtendAttnmodule integrates these two attention strategies:Normal Attentionis applied to tokens within a neighborhood window, maintaining precise positional information for closely related tokens.Grouped Attentionis used for tokens outside this neighborhood window. It reduces the granularity of positional information for distant tokens, which is less critical but still contributes to the overall context understanding.Merge StrategyThe attention values outside the neighborhood window are replaced by those obtained from the grouped attention. This merging strategy ensures a smooth transition and efficient processing of longer sequences while preserving the essential context captured by the normal attention within the neighborhood window.Positional EncodingSine and cosine functions generate positional encodings, ensuring that the model retains an understanding of token order and position.Implementation DetailsModule Class:SelfExtendAttnis implemented as a subclass ofnn.Modulein PyTorch.Configurability: Key parameters such as group size and neighbor window size are configurable.Causal Masking: Ensures that the attention mechanism respects the autoregressive property of language models.Citation@misc{jin2024llm,
    title={LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuning}, 
    author={Hongye Jin and Xiaotian Han and Jingfeng Yang and Zhimeng Jiang and Zirui Liu and Chia-Yuan Chang and Huiyuan Chen and Xia Hu},
    year={2024},
    eprint={2401.01325},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}LicenseMIT
Package: selfless
selflessA small experimental, work-in-progress, module for implicit “self”
support in Python (in some restricted contexts), targeting Python 2.7
(if possible) and 3.6+.Documentation and explicit examples will be added when the module is
more mature. This is used as a dependency for another module; when that
module is made public, the existence of this module will be justified.What is this?If you don’t know, you probably don’t need it. It can be used as an
example of AST transformer though.In some contexts (this will be clarified in the future), writing and
readingself.polutes the code and can be cumbersome. This module
tries to alleviate that in some specific contexts.How does it work?This module inspects the source code of a class, extracts its AST and
insertsself.for variables in a list (if provided) or variables not
in the global and local contexts at the time of import.Finally, the transformed AST is compiled and inserting into the original
context of the classselflesswas applied to.I’m also trying to restrict the transform to the ``with`` keyword but
it’s a work-in-progress.
Package: self-projection
SelfProjection Module for PyTorchSelfProjection Module for PyTorchOverviewApproachInstallationUsageEvaluationFuture DirectionsContributionOverviewTheSelfProjectionmodule is a PyTorch-based neural network layer designed to transform and project high-dimensional data. It is particularly useful in contexts requiring sophisticated analysis and representation of feature relationships, such as outputs from Transformer models.ApproachTheSelfProjectionmodule employs a dual projection mechanism to process input tensors, capturing different perspectives of the data. Key aspects include:Original and Permuted Projections: The module processes the input tensor in its original form and a permuted form, creating two distinct representations.Relational Interference: By computing relational matrices, the module captures the interplay between different projections, emphasizing the relationships between data dimensions.Normalization: Custom normalization steps, which involve mean subtraction and variance scaling similar to Layer Normalization, are applied to the projections, ensuring stable feature scaling and potentially improved model performance.Trainable Parameters: The module includes several trainable parameters, allowing it to learn optimal feature transformations during training.InstallationUsing pip:To install theSelfProjectionmodule using pip, simply run the following command:pipinstallself-projectionFrom source:To install theSelfProjectionmodule, clone this repository and import the module into your PyTorch project.gitclonehttps://github.com/Sombressoul/self-projection./self_projection
python-mpipinstall-e./self_projectionUsageHere's a simple example of how to use theSelfProjectionwith PyTorch:importtorchfromself_projectionimportSelfProjection# Define the input tensor dimensions and projection sizeinput_tensor=torch.randn((batch_size,sequence_length,embedding_dim))size_projection=128# Initialize the SelfProjection moduleself_projection=SelfProjection(size_input=input_tensor.size()[1::],size_projection=size_projection)# Apply the module to the input tensorprojected,relations=self_projection(input_tensor)print(projected.shape)# >>> torch.Size([<batch_size>, 128, 128])print(relations.shape)# >>> torch.Size([<batch_size>, 128, 128])Evaluation(deleted as outdated since 20.01.2024)Pending.Future DirectionsThe ongoing development of theSelfProjectionmodule is a component of a personal endeavor in the field of machine learning. Future plans include conducting experiments with more complex datasets to further assess and refine the module's capabilities. These steps are aimed at exploring a broader range of applications and enhancing the module's performance in diverse settings.This module is a reflection of my interest in contributing to the machine learning community through individual efforts and is one aspect of a larger personal project dedicated to exploring innovative approaches in the field.ContributionContributions to theSelfProjectionmodule are welcome. Please submit a pull request or open an issue if you have suggestions or improvements.
Package: self-py
perf-pyA library that personally helps me understand the performance of common python code (and in turn, it might help you understand it too!)TodoDoes mapping over an iterator perform better than using generators?Does chunking a generator affect performance?Does composing generators affect performance?Make a table of the performance of each function ...Open this up in a notebook!Personal RemindersTo publish to pypi w/o an alpha version, push a commit withPublish To PYPIin its commit message.
Package: selfsne
Self-SNE is a probabilistic self-supervised deep learning model for compressing high-dimensional data to a low-dimensional embedding. It is a general-purpose algorithm that works with multiple types of data including images, sequences, and tabular data. It uses self-supervised objectives, such as InfoNCE, to preserve structure in the compressed latent space. Self-SNE can also (optionally) simultaneously learn a cluster distribution (a prior over the latent embedding) during optimization. Overlapping clusters are automatically combined by optimizing a variational upper bound on entropy, so the number of clusters does not have to be specified manually — provided the number of initial clusters is large enough. Self-SNE produces embeddings with similar quality to existing dimensionality reduction methods; can detect outliers; scales to large, out-of-core datasets; and can easily add new data to an existing embedding/clustering.
Package: selfusepy
Self-Use Python LibDirTreeJson To ObjectUsagemore info injson_test_casesimportselfusepyobj:One=selfusepy.parse_json(jsonStr,One())NoticeBecause Python is not a strongly-typed language, so you must
assign a value when you define a variable in class, 
otherwise the parser can not get the right type of each variable, 
just like examples belowe.g. 1Python Classfromselfusepy.jsonparseimportBaseJsonObjectclassOne(BaseJsonObject):def__init__(self):self.x:str=''# have to be initself.two:One.Two=One.Two()# have to be initclassTwo(BaseJsonObject):def__init__(self):self.y:str=''self.three:One.Two.Three=One.Two.Three()classThree(BaseJsonObject):def__init__(self):self.z:str=''Json str{"x":"x","two":{"y":"y","three":{"z":"z"}}}e.g. 2Python Classfromselfusepy.jsonparseimportBaseJsonObjectfromtypingimportListclassOne1(BaseJsonObject):def__init__(self):self.x:str=''self.two:List[One1.Two]=[One1.Two()]classTwo(BaseJsonObject):def__init__(self):self.y:str=''Json str{"x":"x","two":[{"y":"y1"},{"y":"y2"}]}e.g. 4fromselfusepy.jsonparseimportDeserializeConfig,BaseJsonObjectfromselfusepy.utilsimportoverride_str@override_str@DeserializeConfig({'x--':'x'})classOne2(BaseJsonObject):def__init__(self):self.x:str=''self.two:One2.Two=One2.Two()@override_str@DeserializeConfig({'y--':'y'})classTwo(BaseJsonObject):def__init__(self):self.y:str=''self.three:One2.Two.Three=One2.Two.Three()@override_str@DeserializeConfig({'z--':'z'})classThree(BaseJsonObject):def__init__(self):self.z:str=''Json str{"x--":"x","two":{"y--":"y","three":{"z--":"z"}}}e.g. 5defhandle(x):returndatetime.fromisoformat(x)@DeserializeConfig({"date":JsonField(func=handle)})classObj(BaseJsonObject):def__init__(self):self.date:datetime=datetime.now()