GPI: GenAI-Powered Inference
Getting Started
Installation
Requirements
From PyPI (Version 0.2.1)
From Source
What Is GPI?
GPI Workflow
Current Package Scope
How to Use a GPU
Checking CUDA
Using a Hosted GPU
Using Remote Model Execution
Questions and Bug Reports
Data Generation
Generating Texts with Llama 3
Loading Llama 3.1
Creating Texts
Repeating Existing Texts
Pooling
Custom System Instruction
Additional Arguments
Generating Texts with Other LLMs
Loading Gemma 2
Generating and Saving Representations
Mean Pooling Across Generation Steps
Generating Texts without a Local GPU
Installing and Authenticating
Choosing an Available Model
Remote Generation and Hidden States
Important Notes
Generating Images with Stable Diffusion
How the Image Representation Is Constructed
Using
extract_images
Transforming Multiple Images
Arguments
Generating Videos using Cosmos Tokenizer
What is Cosmos Tokenizer?
Installing the Video Dependencies
How to use Cosmos Tokenizer
Arguments
Output Files
Command-Line Interface
Important Notes
Transcribing Audio using Whisper
What is Whisper?
Installing Whisper
Choosing a Whisper Model
Command-Line Usage
Python Usage
Transcribing Audio from a Video
Aligning Transcripts with Video Segments
Important Notes
Basic Operations
Text-As-Treatment
What is Text-As-Treatment?
How to estimate treatment effects
Step 1: Load the Internal Representations
Step 2: Estimate the Treatment Effects
How to control confounders
Method 1: Using a Formula with a DataFrame
Method 2: Using a Design Matrix
Visualizing Propensity Scores
Hyperparameters
Text-As-Confounder
What is Text-As-Confounder?
How to estimate treatment effects
Image-As-Treatment
How to estimate treatment effects
Step 1: Load the Internal Representations
Using Flattened Representations
Using a Convolutional Neural Network
Step 2: Estimate the Treatment Effects
Video-as-Treatment
Overview of the Data
Step 1: Extract the Video Representations
Step 2: Align and Pad the Sequences
Step 3: Estimate the Intervention Curve
Real-Time Outcomes
Segment-Specific Interventions
Modality and Audio Support
Advanced Operations
Hyperparameter Tuning
Automated Hyperparameter Tuning
Static Hyperparameter Tuning
Static Search Space
Dynamic Hyperparameter Tuning
Dynamic Search Space
Repeated Outcomes
Important Notes
Customizing Your Analysis
TarNet
Propensity Score Model
Cross-Fitted Score Contributions
Complete Cross-Fitting
When an LLM Is Too Large
Installing bitsandbytes
Loading a 4-bit Model
References
Function Reference
Text Generation
Image Generation
Video Processing
Static Inference
Dynamic Inference
dml_score
Description
Arguments
Returns
Example Usage
estimate_k_ate
Description
Arguments
Returns
Example Usage
estimate_psi_split
Description
Arguments
Returns
Example Usage
extract_and_save_hidden_states
Description
Arguments
Returns
Example Usage
generate_text
Description
Arguments
Pooling Behavior
Returns
Example Usage
get_instruction
Description
Arguments
Returns
Example Usage
load_hiddens
Description
Arguments
Returns
Example Usage
save_generated_texts
Description
Arguments
Returns
Example Usage
pad_to_multiple_of_8
Description
Arguments
Returns
Example Usage
StableDiffusionImg2ImgExtractor
Description
Parameters
Example Usage
Methods
preprocess_image
encode_prompt
get_hidden_states
decode_latents
transform_image
save_image
extract_images
Description
Arguments
Returns
Example Usage
CosmosVideoExtractor
Description
Parameters
Example Usage
Methods
preprocess_video
encode_video
decode_latents
reconstruct_video
transform_video
save_video
process_video
VideoExtractionResult
Description
Attributes
Example Usage
VideoSegmentOutput
Description
Attributes
Example Usage
extract_videos
Description
Arguments
Returns
Example Usage
Saved Payload
Command-Line Interface
Related Module Utilities
TextMLPEncoder
Description
Parameters
Returns
Example Usage
Video3DEncoder
Description
Parameters
Returns
Example Usage
DynamicTarNetBase
Description
Parameters
forward
Example Usage
mse_loss
Description
Arguments
Returns
Example Usage
DynamicTarNet
Description
Parameters
Example Usage
Methods
DynamicGPIHyperparameterTuner
Description
Parameters
Search-Space Behavior
Example Usage
Methods
estimate_k_ipsi
Description
Data Arguments
Cross-Fitting Arguments
Dynamic TarNet Arguments
Downstream Nuisance-Model Arguments
Multimodal Encoder Arguments
Inference Argument
Returns
Example Usage
SpectralNormClassifier
Description
Parameters
Example Usage
Methods
forward
fit
predict_proba
predict
TarNet
Description
Parameters
Example Usage
Methods
create_dataloaders
fit
validate_step
predict
TarNetBase
Description
Parameters
forward
Example Usage
TarNetHyperparameterTuner
Description
Parameters
Example Usage
Methods
GPI: GenAI-Powered Inference
Index
Index