Skip to main content

No project description provided

Project description

Project Setup

Follow these steps to set up the qml-anomaly-detection project using Poetry:

  1. Install Poetry:

    Linux, macOS, Windows (WSL)

    curl -sSL https://install.python-poetry.org | python3 -
    

    Windows Powershell:

    (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
    

    Note: On Windows you must add the pypoetry Scripts path to your PATH environment variable. Poetry by default is installed at %APPDATA%\pypoetry on Windows.

  2. Configure Poetry to use project directory for Virtual Environment

    poetry config virtualenvs.in-project true
    
  3. Install required python version using pyenv

    Install pyenv:

    sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
    curl https://pyenv.run/ | bash
    

    For Windows, refer to the installation here at https://github.com/pyenv-win/pyenv-win?tab=readme-ov-file#installation

    Install python 3.10:

    pyenv install 3.10
    
  4. Clone the qml-anomaly-detection repository

    git clone https://github.com/Manoj-E-S/qml-anomaly-detection.git
    
  5. Set python-version as the local(default) version for the project

    cd qml-anomaly-detection
    pyenv local 3.10
    
  6. Install Dependencies under the python-version specified in pyproject.toml:

    cd qml-anomaly-detection
    poetry env use 3.10
    poetry install
    
  7. Intall torch dependency

    1. If cuda is available:

      • Check cuda version on your device

        nvcc --version
        
      • Add corresponding torch repository source in pyproject.toml (Although this will not be useful in installing pytorch (as it will be installed outside of the dependency management), doing this will be helpful for documentation purposes)

        [[tool.poetry.source]]
        name = "pytorch-gpu-<PLACEHOLDER>"
        url = "https://download.pytorch.org/whl/<PLACEHOLDER>"
        priority = "explicit"
        
      • Install torch in the venv, without updating pyproject.toml

        cd qml-anomaly-detection
        poetry run pip install "torch==2.4.1+<PLACEHOLDER>" --index-url "https://download.pytorch.org/whl/<PLACEHOLDER>"
        
      • Note: Replace PLACEHOLDER with cuda-appropriate repository. Ex: cu121 (for cuda 12.1), cu111 (for cuda 11.1), etc.

    2. If cuda is not available:

      cd qml-anomaly-detection
      poetry run pip install "torch==2.4.1+cpu" --index-url "https://download.pytorch.org/whl/cpu/torch_stable.html"
      
  8. Download the datasets

    Run the following to install the datasets:

    poetry shell
    python datasets/dataset_install.py
    

    If for whatever reason running the above script does not properly install the datasets, Manually download them from here and replace the contents in the datasets directory to form the following structure:
    /datasets/
    ├── ccfraud/
    ├── diabetes/
    ├── KDD Cup 1999/
    └── README.md

  9. Run Your Project:

    poetry shell
    python <your_script>.py
    

We are good to go!

Some useful Poetry Commands

  1. Create a New Poetry Project:

    poetry new <project-name>
    cd <project-name>
    
  2. Add Dependencies:

    poetry add <package-1-name> <package-2-name> ...
    poetry add "<package-name>@<version-specifier>" --source <custom-source-name>
    
  3. Add Group Dependencies (dev-dependencies, test-dependencies, etc):

    poetry add --group <group-name> <package-1-name> <package-2-name> ...
    
  4. Add New Sources:

    poetry source add --priority=<default|primary|supplemental|explicit> <custom-source-name> <source-url>
    
  5. Bring poetry.lock up-to-date with pyproject.toml (without updating dependencies):

    poetry lock --no-update
    
  6. To run the tests:

    poetry run pytest -s
    

    Or to run a specific test file:

    poetry run pytest -s test_file.py
    
  7. Activate the Virtual Environment:

    poetry shell
    
  8. Deactivate the Virtual Environment:

    exit
    

For more details, refer to the Poetry documentation.

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

cqu-0.1.0.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cqu-0.1.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file cqu-0.1.0.tar.gz.

File metadata

  • Download URL: cqu-0.1.0.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for cqu-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3193d5627250bbfba8b8012a3a534b53bf7a93dff0aef7458e7c810c7f8e7b48
MD5 5871d877b514014f95b02629d1a50d03
BLAKE2b-256 4ceb92211a9a8d86989bf5e5d08045c27f282ed1230c283f608c62e2e5837735

See more details on using hashes here.

File details

Details for the file cqu-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cqu-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for cqu-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c32574a7104647475aee0ddef283b1abc86d316f32e7928ce036ee114af2c33
MD5 3a5b446c3d44540e8ae7f5e3b20e1d18
BLAKE2b-256 08511eb6f9117e516a88a3e88222094c173d020d6dd1c57c0eb66bb391648db0

See more details on using hashes here.

Supported by

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