Skip to content

add stable diffusion slackbot blog - #3

Open
benartuso wants to merge 3 commits into
mainfrom
add-slackbot-blog
Open

add stable diffusion slackbot blog#3
benartuso wants to merge 3 commits into
mainfrom
add-slackbot-blog

Conversation

@benartuso

Copy link
Copy Markdown
Contributor

No description provided.

@benartuso
benartuso requested a review from gschoeni August 8, 2023 14:31

## Introduction

Reinforcement Learning from Human Feedback (RLHF) is a powerful tool for improving the performance and alignment of generative models through the direct incorporation of human preferences into model reward functions. While its benefits for both [language modeling](https://arxiv.org/abs/2009.01325) and [image generation](https://arxiv.org/pdf/2302.12192.pdf) applications are well-documented, the pathways to the actual collection of this human evaluation data are often difficult and unclear.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the second link can we do the abstract page again, just because of loading time when I click on it


Reinforcement Learning from Human Feedback (RLHF) is a powerful tool for improving the performance and alignment of generative models through the direct incorporation of human preferences into model reward functions. While its benefits for both [language modeling](https://arxiv.org/abs/2009.01325) and [image generation](https://arxiv.org/pdf/2302.12192.pdf) applications are well-documented, the pathways to the actual collection of this human evaluation data are often difficult and unclear.

At Oxen, we provide a suite of dataset version control tooling that makes this data collection process fast, secure, and infinitely integrable with platforms your team and users already love.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly...I'm cool to take this out, let's lean into the fact that we built this slackbot so that we could build out a large repo of generated Oxen instead of describing oxen in this one.


**Image generation model**

- We’ll use the [`diffusers`](https://github.com/huggingface/diffusers) library and a stable diffusion model hosted on Hugging Face to generate our images. We’re using a model we’ve previously fine-tuned to generate cute cartoonish Oxen (see this tutorial), but is based off of `CompVis/stable-diffusion-v1-4`, which is a great starting point.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should mention modal here as serverless compute


Then remotely commit the image:

```python

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indentation looks funny, and don't we only want to commit if the image is successfully added?

repo.add_df_row(DF_PATH, row)
except Exception as e:
print('Error adding df row to Oxen', e)
repo.commit(f"Remote commit - {row['rater']} voting on image {row['path'].split('/')[-1]}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I think we only want to commit if add was successful


The bot will render ox images in response to prompts from our team with the `/ox` slash command:

![A Slack screenshot showing a slackbot-generated stable diffusion image of a fluffy cartoonish ox digging in to a bowl of almonds. The image has 3 upvote reactions and 2 downvote reactions](images/slackbot-example.png)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we want to hook this up to stable diffusion XL and scratch the link to the other blog, and just say we are catching errors so that we can fine tune later...? Might get some more compelling images out of it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

were you envisioning pure stable diffusion XL, or running dreambooth / lora something on it? / did you end up getting that to work? definitely down either way, these images make me a little sad

python server.py
```

Using [ngrok](https://ngrok.com/), we can expose this port on a public IP to allow us to receive messages from the Slackbot while developing locally.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think we should also use modal here to deploy the serverless flask app, what do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thiiiink we talked about this a while ago but can't totally remember - definitely fine to do so to tighten up the post but I think it's probably not super cost-effective since we'll have to re-download the oxen lib after every slack reaction? and we also don't need GPUs at this stage..but agree that it's awk to tell people to use ngrok and then be like deployment's on you, go check out digital ocean


![Two "disapprove" rows rendered in the OxenHub UI to reflect our team's opinion of the broccoli image](images/broccoli-tabular.png)

Over the next few months, we’ll be using this bot to generate lots of additional training examples from the comfort of our Slack workspace. With this additional training data generated directly from human feedback, we can work on fine-tuning out some of the glitchier oxen (including the broccoli-ox hybrid shown above) and move towards a more consistent, adaptable ox character.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's actually do this with stable diffusion XL, a modal flask server, and a slack cron job that posts into the channel every morning. I think we can do a similar thing as our github stars repo and generate "random" prompts and then we can select the best generations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants