Skip to main content

A python library based on transformers for transfer learning

Project description

Predacons

Predacons is a Python library based on transformers used for transfer learning. It offers a suite of tools for data processing, model training, and text generation, making it easier to apply advanced machine learning techniques to your projects.

PyPI Downloads License Python Version

Installation

To install Predacons, use the following pip command:

pip install predacons

Usage

Here's a quick start guide to using Predacons in your Python projects:

from predacons import predacons

# Initialize the library
predacons.rollout()

# Load documents from a directory
predacons.read_documents_from_directory('your/directory/path')

# Clean text data
cleaned_text = predacons.clean_text("Your dirty text here")

# Train a model with your data
predacons.train(train_file_path="path/to/train/file",
                model_name="your_model_name",
                output_dir="path/to/output/dir",
                overwrite_output_dir=True,
                per_device_train_batch_size=4,
                num_train_epochs=3,
                save_steps=100)

# Generate text using a trained model
generated_text = predacons.generate_text(model_path="path/to/your/model",
                                         sequence="Seed text for generation",
                                         max_length=50)

# Generate chat using a trained model
chat = [
    {"role": "user", "content": "Hey, what ia a car?"}
]
chat_output = predacons.chat_generate(model = model,
        sequence = chat,
        max_length = 50,
        tokenizer = tokenizers,
        trust_remote_code = True)

# Generate embeddings for sentences
from predacons.src.embeddings import PredaconsEmbedding

# this embedding_model object can be used directly in every method langchain   
embedding_model = PredaconsEmbedding(model_name="sentence-transformers/paraphrase-MiniLM-L6-v2")
sentence_embeddings = embedding_model.get_embedding(["Your sentence here", "Another sentence here"])

Features

Predacons provides a comprehensive set of features for working with transformer models, including:

  • Data Loading: Easily load data from directories or files.
  • Text Cleaning: Clean your text data with built-in functions.
  • Model Training: Train transformer models with custom data.
  • Text Generation: Generate text using trained models.
  • Chat Generation: Generate chat responses using trained models.
  • Embeddings: Generate embeddings for sentences using pre-trained transformer models. and is fully compatible with langchain methods

Contributing

Contributions to the Predacons library are welcome! If you have suggestions for improvements or new features, please open an issue first to discuss your ideas. For code contributions, please submit a pull request.

License

This project is licensed under multiple licenses:

  • For free users, the project is licensed under the terms of the GNU Affero General Public License (AGPL). See LICENSE-AGPL for more details.

  • For paid users, there are two options:

Please ensure you understand and comply with the license that applies to you.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

predacons-0.0.126.tar.gz (36.1 kB view details)

Uploaded Source

Built Distribution

predacons-0.0.126-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

Details for the file predacons-0.0.126.tar.gz.

File metadata

  • Download URL: predacons-0.0.126.tar.gz
  • Upload date:
  • Size: 36.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for predacons-0.0.126.tar.gz
Algorithm Hash digest
SHA256 037d2df39e4a0dbe93a753d0055bf72dfd3dcdefcc481cf19e37b80a2f6c235d
MD5 51b333f562bd6308bce30c22d2504b8b
BLAKE2b-256 d9f03e5719810a48520d48d156467d466ad837e96805d9f81dd647bbffdb1aaa

See more details on using hashes here.

File details

Details for the file predacons-0.0.126-py3-none-any.whl.

File metadata

  • Download URL: predacons-0.0.126-py3-none-any.whl
  • Upload date:
  • Size: 43.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for predacons-0.0.126-py3-none-any.whl
Algorithm Hash digest
SHA256 750cff95c3caf4be7f0d529809118fff6d7b04d5af44deae51fe446bfbf07725
MD5 e243017c56858613161b86c6e5ff495d
BLAKE2b-256 d003779d5ac669446cfb979bd9c1b20ed1d4698135758c408f117b78b2497b42

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page