FMInference / FlexLLMGen

Running large language models on a single GPU for throughput-oriented scenarios.
Apache License 2.0
9.18k stars 548 forks source link

ValueError: cannot reshape array of size 0 into shape (7168,28672) #41

Open progressionnetwork opened 1 year ago

progressionnetwork commented 1 year ago

Hello!

I got an error with running: python -m flexgen.flex_opt --model facebook/opt-30b --percent 0 100 100 0 100 0

warmup - init weights
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\FlexGen\flexgen\flex_opt.py", line 1314, in <module>
    run_flexgen(args)
  File "D:\FlexGen\flexgen\flex_opt.py", line 1206, in run_flexgen
    model.init_all_weights()
  File "D:\FlexGen\flexgen\flex_opt.py", line 793, in init_all_weights
    self.init_weight(j)
  File "D:\FlexGen\flexgen\flex_opt.py", line 650, in init_weight
    self.layers[j].init_weight(self.weight_home[j], expanded_path)
  File "D:\FlexGen\flexgen\flex_opt.py", line 500, in init_weight
    weights = init_weight_list(weight_specs, self.policy, self.env)
  File "D:\FlexGen\flexgen\flex_opt.py", line 121, in init_weight_list
    weight.load_from_np_file(weight_specs[i][2])
  File "D:\FlexGen\flexgen\pytorch_backend.py", line 124, in load_from_np_file
    self.load_from_np(np.load(filename))
  File "D:\venv\lib\site-packages\numpy\lib\npyio.py", line 432, in load
    return format.read_array(fid, allow_pickle=allow_pickle,
  File "D:\venv\lib\site-packages\numpy\lib\format.py", line 831, in read_array
    array.shape = shape
ValueError: cannot reshape array of size 0 into shape (7168,28672)
syoyo commented 1 year ago

Probably you failed to extract weight data(in default ~/opt_weights https://github.com/FMInference/FlexGen/blob/main/flexgen/flex_opt.py#L1273) e.g. by running out free disk space.

Deleting a weight folder and regenerate weight data would solve the issue.