jy0205 / Pyramid-Flow

Code of Pyramidal Flow Matching for Efficient Video Generative Modeling
https://pyramid-flow.github.io/
MIT License
1.95k stars 172 forks source link

on colab: OSError: Error no file named config.json found in directory /content/Pyramid-Flow/diffusion_transformer_384p/. #125

Open noah1320 opened 2 days ago

noah1320 commented 2 days ago

variant='diffusion_transformer_384p'       # For low resolution

model_path = "/content/Pyramid-Flow"   # The downloaded checkpoint dir
model_dtype = 'bf16'

device_id = 0
torch.cuda.set_device(device_id)

model = PyramidDiTForVideoGeneration(
    model_path,
    model_dtype,
    model_variant=variant,
)

model.vae.to("cuda")
model.dit.to("cuda")
model.text_encoder.to("cuda")

model.vae.enable_tiling()

if model_dtype == "bf16":
    torch_dtype = torch.bfloat16 
elif model_dtype == "fp16":
    torch_dtype = torch.float16
else:
    torch_dtype = torch.float32`

using half precision

OSError Traceback (most recent call last) in <cell line: 9>() 7 torch.cuda.set_device(device_id) 8 ----> 9 model = PyramidDiTForVideoGeneration( 10 model_path, 11 model_dtype,

4 frames /content/Pyramid-Flow/pyramid_dit/pyramid_dit_for_video_gen_pipeline.py in init(self, model_path, model_dtype, use_gradient_checkpointing, return_log, model_variant, timestep_shift, stage_range, sample_ratios, scheduler_gamma, use_mixed_training, use_flash_attn, load_text_encoder, load_vae, max_temporal_length, frame_per_unit, use_temporal_causal, corrupt_ratio, interp_condition_pos, stages, **kwargs) 88 else: 89 print("using half precision") ---> 90 self.dit = PyramidDiffusionMMDiT.from_pretrained( 91 dit_path, torch_dtype=torch_dtype, 92 use_gradient_checkpointing=use_gradient_checkpointing,

/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py in _inner_fn(*args, *kwargs) 112 kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.name, has_token=has_token, kwargs=kwargs) 113 --> 114 return fn(args, **kwargs) 115 116 return _inner_fn # type: ignore

/usr/local/lib/python3.10/dist-packages/diffusers/models/modeling_utils.py in from_pretrained(cls, pretrained_model_name_or_path, **kwargs) 610 611 # load config --> 612 config, unused_kwargs, commit_hash = cls.load_config( 613 config_path, 614 cache_dir=cache_dir,

/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py in _inner_fn(*args, *kwargs) 112 kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.name, has_token=has_token, kwargs=kwargs) 113 --> 114 return fn(args, **kwargs) 115 116 return _inner_fn # type: ignore

/usr/local/lib/python3.10/dist-packages/diffusers/configuration_utils.py in load_config(cls, pretrained_model_name_or_path, return_unused_kwargs, return_commit_hash, **kwargs) 371 config_file = os.path.join(pretrained_model_name_or_path, cls.config_name) 372 else: --> 373 raise EnvironmentError( 374 f"Error no file named {cls.config_name} found in directory {pretrained_model_name_or_path}." 375 )

OSError: Error no file named config.json found in directory /content/Pyramid-Flow/diffusion_transformer_384p.

Even though i downloaded /content/Pyramid-Flow/ └── diffusion_transformer_384p/ ├── config.json └── diffusion_pytorch_model.safetensors Can you please help

feifeiobama commented 1 day ago

I am not familiar with the file structure on colab. Could you add some print function in the code to confirm that the checkpoint indeed exists? Or could you switch between absolute path and relative path, maybe one of them will work.

noah1320 commented 1 day ago

When I run print(os.listdir("/content/Pyramid-Flow/diffusion_transformer_384p/")) I got ['diffusion_pytorch_model.safetensors', 'config.json']

feifeiobama commented 1 day ago

When I run print(os.listdir("/content/Pyramid-Flow/diffusion_transformer_384p/")) I got ['diffusion_pytorch_model.safetensors', 'config.json']

This confirms that the checkpoint is already there. While I have no clue of the cause of this error, perhaps you can try to use relative path instead.