|
8 | 8 | python scripts/convert_cogview4_to_diffusers.py \ |
9 | 9 | --transformer_checkpoint_path 'your path/cogview4_6b/1/mp_rank_00_model_states.pt' \ |
10 | 10 | --vae_checkpoint_path 'your path/cogview4_6b/imagekl_ch16.pt' \ |
11 | | - --output_path "/raid/yiyi/CogBiew4-6B" \ |
| 11 | + --output_path "THUDM/CogView4-6B" \ |
12 | 12 | --dtype "bf16" |
13 | 13 |
|
14 | 14 | Arguments: |
@@ -209,12 +209,21 @@ def main(args): |
209 | 209 | if dtype is not None: |
210 | 210 | vae = vae.to(dtype=dtype) |
211 | 211 |
|
212 | | - text_encoder_id = "THUDM/glm-4-9b-hf" |
213 | | - tokenizer = PreTrainedTokenizerFast.from_pretrained(text_encoder_id) |
214 | | - text_encoder = GlmForCausalLM.from_pretrained( |
| 212 | + # text_encoder_id = "THUDM/glm-4-9b-hf" |
| 213 | + # tokenizer = PreTrainedTokenizerFast.from_pretrained(text_encoder_id) |
| 214 | + # text_encoder = GlmForCausalLM.from_pretrained( |
| 215 | + # text_encoder_id, |
| 216 | + # cache_dir=args.text_encoder_cache_dir, |
| 217 | + # torch_dtype=torch.bfloat16 if args.dtype == "bf16" else torch.float32, |
| 218 | + # ) |
| 219 | + from transformers import AutoTokenizer,AutoModel |
| 220 | + text_encoder_id = "/share/home/zyx/Models/Megatron-VLM/examples/dit/ckpts/glm-4-9b" |
| 221 | + tokenizer = AutoTokenizer.from_pretrained(text_encoder_id,trust_remote_code=True) |
| 222 | + text_encoder = AutoModel.from_pretrained( |
215 | 223 | text_encoder_id, |
216 | 224 | cache_dir=args.text_encoder_cache_dir, |
217 | 225 | torch_dtype=torch.bfloat16 if args.dtype == "bf16" else torch.float32, |
| 226 | + trust_remote_code = True |
218 | 227 | ) |
219 | 228 | # Apparently, the conversion does not work anymore without this :shrug: |
220 | 229 | for param in text_encoder.parameters(): |
|
0 commit comments