FlexGen icon indicating copy to clipboard operation
FlexGen copied to clipboard

Doesn't seem to obey --path argument, instead try to download to .cache again

Open hsaito opened this issue 2 years ago • 4 comments

On Windows at least, it seems to be path is not obeyed and kept downloading into .cache directory of the c:\ file system (which I don't have enough space.)

I've manually downloaded required files into other drive, where the relative path is ../models--facebook--opt-30b

Executing python -m flexgen.flex_opt --model facebook/opt-30b --path ../models--facebook--opt-30b still causes it to download the item into aforementioned .cache directory -- tried other variant python -m flexgen.flex_opt --model facebook/opt-30b --path ../models--facebook--opt-30b/snapshots/ceea0a90ac0f6fae7c2c34bcb40477438c152546.

Am I misunderstanding the way --path work or there's something wrong with it?

Also it would be nice to have the option to inhibit all the automatic download and just stop with error as I do not want to exhaust disk space that's already precious...

hsaito avatar Feb 21 '23 07:02 hsaito

Before the argument --path works, FlexGen will download weights by using huggingface/transformers, which will use .cache by default. Then FlexGen converts the huggingface format to its own format.

The weight download function is here. https://github.com/Ying1123/FlexGen-dev/blob/876fff7d33caecca5c972efcf5028fe6250ceeae/flexgen/flex_opt.py#L641-L642 If you are familiar with how huggingface/transformers work, you can modify it for your needs.

Ying1123 avatar Feb 22 '23 09:02 Ying1123

You can modify where the transformers module places cached files by setting the environment variable TRANSFORMERS_CACHE. See here for additional information: https://stackoverflow.com/questions/63312859/how-to-change-huggingface-transformers-default-cache-directory

freedmand avatar Feb 22 '23 15:02 freedmand

@Ying1123 Hi, I have the same confusion when I downloaded the model of facebook/opt-30b from huggingface, and the model files can't be recognized by transformers==4.25.1, so is there a way to use local weights?
image

image

Yang-HangWA avatar Feb 24 '23 02:02 Yang-HangWA

@hsaito PR #111 allows to use --local argument to load manually downloaded model, you can have a try

Vinkle-hzt avatar Apr 28 '23 02:04 Vinkle-hzt