Using Gemini for batch inference
You can use Gemini for batch inference in Curator to generate synthetic data. In this example, we will generate reannotation of wildchat dataset, but the approach can be adapted for any data generation task.
Prerequisites
Python 3.10+
Curator: Install via
pip install bespokelabs-curator
Gemini (Vertex AI): GCP account with Vertex AI enabled.
Google Cloud Bucket: Access to cloud storage.
Steps
1. Setup environment vars
2. ADC authentication
3. Create a curator.LLM subclass
Create a class that inherits from curator.LLM
. Implement two key methods:
prompt()
: Generates the prompt for the LLM.parse()
: Processes the LLM's response into your desired format.
Here’s the implementation:
3. Configure the Gemini Backend
4. Generate Data
Generate the structured data and output the results as a pandas DataFrame:
Example Output
Using the above example, the output might look like this:
Write a very long, elaborate, descriptive and ...
Scene: Omelette Apocalypse\n\n**INT. DINER...
what are you?
I am a large language model, trained by Google
Gemini Batch Configuration
Check out complete batch configuration
Check out Gemini generation parameters
Last updated