Unknown keyword argument when using accelerate

Hello,

I’ve been trying to convert a colab notebook code that trains stable diffusion into a script. The notebook uses accelerate.notebook_launcher. For the script I’m using cli “accelerate launch” but for some reason when I try to save the model using

    pipeline = StableDiffusionPipeline(
        text_encoder=text_encoder,
        vae=vae,
        unet=accelerator.unwrap_model(unet),
        tokenizer=tokenizer,
        scheduler=PNDMScheduler(
            beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear", skip_prk_steps=True
        ),
        safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker"),
        feature_extractor=CLIPFeatureExtractor.from_pretrained("openai/clip-vit-base-patch32"),
    )
    pipeline.save_pretrained(args.output_dir) 

I get an error about unexpected keyword argument

line 315, in training_function
    pipeline = StableDiffusionPipeline(
TypeError: __init__() got an unexpected keyword argument 'safety_checker'

I’ve no idea where to start looking for the problem.
Thanks for any insights!