about the model path

#1
by nxlogn - opened

hello, I am trying to deploy the model in my environment, but I am confused about the model_path. Is it the file named pytorch_model_0001-0003?
屏幕截图 2023-12-08 163751.png

FreedomAI org

When deploying a large model with weights that exceed the file size limits of the system or are simply too large to be managed efficiently as a single file, it is common practice to split the model's weights into multiple segments. These segments are often named in a sequence, such as pytorch_model_0001-0003.bin, indicating different parts of the model's weights.

In such cases, you would typically find a file named pytorch_model.bin.index.json in the model's directory. This JSON file acts as a manifest, mapping which weights are contained in each binary segment file. This allows the loading process to understand how to reconstruct the full model's weights from the segmented files.

When you are setting up the model_path in your environment, you should point it to the directory containing these files rather than any individual segment file. The model loading utility will reference the .index.json file to correctly assemble the weights and load the model.

Here is an example of how you might set the model_path:

model_directory = "/path/to/your/model/directory"  # This should be the directory containing the segmented weight files and the index.json.
model = YourModelClass.from_pretrained(model_directory)

Make sure that the YourModelClass.from_pretrained method or its equivalent in your framework is designed to handle the indexed loading process. If you're using a custom loading mechanism, you would need to implement the logic to parse the .index.json file and load the weights accordingly.

XiangBo changed discussion status to closed

Thank you, it's very helpful, I have put all the files in the directory followed by the instructions, but still does not work fine.
屏幕截图 2023-12-09 125040.png

屏幕截图 2023-12-09 125417.png

FreedomAI org

We hope this message finds you well.

We would like to extend our sincerest apologies for the confusion caused by the incorrect instructions provided in our GitHub README file. We appreciate your patience and understanding as we address this oversight.

To run the script correctly, please use the following command without the -m flag:

python huatuo_cli_demo_stream.py --model-name $model_dir

The -m flag is typically used for loading modules, whereas the command you need is intended to execute a script directly. We have updated our README to reflect this correction and prevent any future misunderstandings.

Thank you for bringing this to our attention. Should you have any further questions or require additional assistance, please do not hesitate to reach out.

Best regards,

Sign up or log in to comment