Marlon Wiprud commited on
Commit
41902fa
·
1 Parent(s): 8a1601c
Files changed (1) hide show
  1. handler.py +1 -8
handler.py CHANGED
@@ -18,9 +18,6 @@ logging.basicConfig(level=logging.INFO)
18
  hf_logging.set_verbosity_debug()
19
 
20
 
21
- # 2023/11/28 06:41:40 ~ loading configuration file generation_config.json from cache at /root/.cache/huggingface/hub/models--THUDM--cogvlm-chat-hf/snapshots/8abca878c4257412c4c38eeafaed3fe27a036730/generation_config.json
22
-
23
-
24
  def list_files(directory, depth, max_depth=5):
25
  # Lists all files and directories in the given directory
26
  for filename in os.listdir(directory):
@@ -58,7 +55,7 @@ class EndpointHandler:
58
  with init_empty_weights():
59
  self.model = AutoModelForCausalLM.from_pretrained(
60
  "THUDM/cogvlm-chat-hf",
61
- torch_dtype=torch.bfloat16,
62
  low_cpu_mem_usage=True,
63
  trust_remote_code=True,
64
  )
@@ -78,13 +75,9 @@ class EndpointHandler:
78
  no_split_module_classes=["CogVLMDecoderLayer"],
79
  )
80
 
81
- # .cache/huggingface/hub/models--THUDM--cogvlm-chat-hf/snapshots/8abca878c4257412c4c38eeafaed3fe27a036730
82
  self.model = load_checkpoint_and_dispatch(
83
  self.model,
84
  "/root/.cache/huggingface/hub/models--THUDM--cogvlm-chat-hf/snapshots/8abca878c4257412c4c38eeafaed3fe27a036730",
85
- # "~/.cache/huggingface/hub/models--THUDM--cogvlm-chat-hf/snapshots/8abca878c4257412c4c38eeafaed3fe27a036730",
86
- # "/home/ec2-user/.cache/huggingface/hub/models--THUDM--cogvlm-chat-hf/snapshots/8abca878c4257412c4c38eeafaed3fe27a036730", # typical, '~/.cache/huggingface/hub/models--THUDM--cogvlm-chat-hf/snapshots/balabala'
87
- # "~/.cache/huggingface/modules/transformers_modules/THUDM/cogvlm-chat-hf/8abca878c4257412c4c38eeafaed3fe27a036730", # typical, '~/.cache/huggingface/hub/models--THUDM--cogvlm-chat-hf/snapshots/balabala'
88
  device_map=device_map,
89
  no_split_module_classes=["CogVLMDecoderLayer"],
90
  )
 
18
  hf_logging.set_verbosity_debug()
19
 
20
 
 
 
 
21
  def list_files(directory, depth, max_depth=5):
22
  # Lists all files and directories in the given directory
23
  for filename in os.listdir(directory):
 
55
  with init_empty_weights():
56
  self.model = AutoModelForCausalLM.from_pretrained(
57
  "THUDM/cogvlm-chat-hf",
58
+ torch_dtype=torch.float16,
59
  low_cpu_mem_usage=True,
60
  trust_remote_code=True,
61
  )
 
75
  no_split_module_classes=["CogVLMDecoderLayer"],
76
  )
77
 
 
78
  self.model = load_checkpoint_and_dispatch(
79
  self.model,
80
  "/root/.cache/huggingface/hub/models--THUDM--cogvlm-chat-hf/snapshots/8abca878c4257412c4c38eeafaed3fe27a036730",
 
 
 
81
  device_map=device_map,
82
  no_split_module_classes=["CogVLMDecoderLayer"],
83
  )