code: def create_model(name):
      checkpoint = paddle.load(
          os.path.join(
              os.path.dirname(__file__),
              "pre_trained",
              "{}.pdparams".format(name),
          )
      )
      model_name = _MODEL_INFO[name]["struct"]
      vision_model, text_model = model_name.split("@")
      # Initialize the model.
      vision_model_config_file = (
          Path(__file__).parent
          / f"model_configs/{vision_model.replace('/', '-')}.json"
      )
      print(
          "Loading vision model config from", vision_model_config_file
      )
      assert os.path.exists(vision_model_config_file)
  
      text_model_config_file = (
          Path(__file__).parent
          / f"model_configs/{text_model.replace('/', '-')}.json"
      )
      print("Loading text model config from", text_model_config_file)
      assert os.path.exists(text_model_config_file)
  
      with open(vision_model_config_file, "r") as fv, open(
          text_model_config_file, "r"
      ) as ft:
          model_info = json.load(fv)
          for k, v in json.load(ft).items():
              model_info[k] = v
  
      model = CLIP(**model_info)
      model.set_state_dict(checkpoint)
      return model
  
file_path: PaddleHub/modules/image/text_to_image/disco_diffusion_cnclip_vitb16/cn_clip/clip/utils.py
imports: import json
  import os
  from pathlib import Path
  from typing import List
  from typing import Union
  import paddle
  from disco_diffusion_cnclip_vitb16.cn_clip.clip import _tokenizer
  from disco_diffusion_cnclip_vitb16.cn_clip.clip.model import CLIP
  from tqdm import tqdm
label_desc: Use image node_id 3 for calling a global function with example usage: create_model(name) and returns: model