Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Dockerized PyRIT with Jupyter Notebook Support #767

Open
ErdemOzgen opened this issue Mar 7, 2025 · 6 comments · May be fixed by #784
Open

FEAT: Dockerized PyRIT with Jupyter Notebook Support #767

ErdemOzgen opened this issue Mar 7, 2025 · 6 comments · May be fixed by #784
Assignees
Labels
enhancement New feature or request

Comments

@ErdemOzgen
Copy link

Is your feature request related to a problem? Please describe.

Users need to manage dependencies, compatibility issues, and configuration steps individually, often leading to inconsistent environments and installation failures across different systems. This creates barriers to entry for new users and unnecessary friction for experienced users who want to quickly deploy Pyrit in different environments.

Describe the solution you'd like

I propose adding a Dockerfile to the Pyrit repository that includes:

  • A pre-configured environment with all necessary dependencies for Pyrit
  • JupyterNotebook integration for interactive usage and tutorials
  • Proper configuration of GPU support (if applicable)
  • Documentation for building and running the Docker container

This solution would make Pyrit more accessible and portable by allowing users to run it in a consistent, isolated environment without needing to modify their host system or create specialized conda environments. Users would be able to get started with a simple docker pull and docker run command sequence.
The Dockerfile should:

  • Use an appropriate base image (e.g., Python-based)
  • Install all required system dependencies
  • Configure Pyrit and its components correctly
  • Expose appropriate ports for JupyterNotebook access
  • Include sample notebooks demonstrating basic Pyrit functionality

Possible base image : https://quay.io/repository/jupyter/pytorch-notebook?tab=tags&tag=latest

I am willing to contribute to this feature's development if the maintainers are receptive to the idea.

@romanlutz
Copy link
Contributor

@ErdemOzgen we're definitely interested. There's an existing Dockerfile that we use to run the GCG attack in Azure (you can find it by searching for a Dockerfile in the repo). Very similar to what you're describing. I'd love to see if we can stick with a single Dockerfile for all cases, and I'm not opinionated on which one. I just struggled a lot with making the container actually use torch properly so I ended up with one that Azure provides.

The existing one has some issues, too. It just installs the latest version of main rather than having one per release, for example. And we install FastChat from the FastChat repo because they didn't have something we needed in their latest release. It appears they haven't had a release in 1+ year so that is probably still a problem, at least for GCG.

@romanlutz romanlutz added the enhancement New feature or request label Mar 7, 2025
@ErdemOzgen
Copy link
Author

I'll start working on this issue immediately and will focus on:

  1. Examining the existing Dockerfile to understand its current structure and limitations
  2. Creating a unified Dockerfile solution that can serve multiple purposes (including GCG attack and JupyterNotebook support)
  3. Addressing the version control concerns by implementing proper release tagging
  4. Resolving the FastChat dependency issue

Regarding the PyTorch integration challenges you mentioned, I've worked with similar configurations before and will pay special attention to ensuring proper GPU utilization and PyTorch compatibility across different environments.

I'll create a development branch with my proposed changes and provide regular updates on my progress. Feel free to assign this issue to me, and I'll submit an initial pull request with a prototype solution within the following weeks for your review.

Would you prefer I start from the existing Dockerfile and modify it, or would you be open to a fresh implementation that incorporates the best elements of the current solution?

@romanlutz
Copy link
Contributor

Amazing! I have no opinions on the base image besides

  • it needs to be freely available, ideally without requiring an account
  • it needs to be secure, so ideally some kind of reputable company/institute vouches for the image. I'm being a bit vague here, but for example the one I used is curated by Azure so that lends some credibility. They regularly update these.

So by all means, feel free to explore options.

@romanlutz romanlutz changed the title Feature Request: Dockerized Pyrit with Jupyter Notebook Support FEAT: Dockerized PyRIT with Jupyter Notebook Support Mar 7, 2025
@ErdemOzgen
Copy link
Author

@romanlutz,

I've created an initial proof of concept implementation before submitting a formal PR. The changes can be viewed here:
ErdemOzgen@54f5bc5

I'd appreciate your feedback on this approach before proceeding with a full PR. Let me know if you have any questions or suggestions for improvements.

Thanks!

@romanlutz
Copy link
Contributor

Thanks @ErdemOzgen ! I see you went with a Microsoft-provided image after all 🙂

@bashirpartovi @rlundeen2 may have thoughts. To me, this looks ready for a PR so that we can leave detailed comments. The high-level approach makes sense to me.

You might want to install pyrit with the "all" extra, i.e. pip install pyrit[all] so that all functionality is support. E.g., GCG won't work without that.

I would love to consolidate and use this instead of the GCG Dockerfile that we have elsewhere in the repo, too, but that can also be a follow-up item.

@ErdemOzgen
Copy link
Author

@romanlutz The pull request has been opened and is now available for review at #784

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants