mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +00:00
fixed macos code
This commit is contained in:
parent
cf593c7c52
commit
a6c19e8e79
@ -138,6 +138,7 @@ else
|
||||
* ) echo "Skipping download of model file...";;
|
||||
esac
|
||||
fi
|
||||
#!/bin/bash
|
||||
|
||||
echo ""
|
||||
echo "Downloading latest model..."
|
||||
@ -168,13 +169,13 @@ case $yn in
|
||||
echo "[$count] $f"
|
||||
done
|
||||
|
||||
Prompt user to choose a model to convert
|
||||
# Prompt user to choose a model to convert
|
||||
read -p "Enter the number of the model you want to convert: " modelNumber
|
||||
|
||||
if [ -z "${file[modelNumber]}" ]; then
|
||||
echo ""
|
||||
echo "Invalid option. Restarting..."
|
||||
exit 1
|
||||
echo ""
|
||||
echo "Invalid option. Restarting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
modelPath="${file[modelNumber]}"
|
||||
@ -182,44 +183,37 @@ case $yn in
|
||||
echo ""
|
||||
echo "You selected $modelPath"
|
||||
|
||||
Ask user if they want to convert the model
|
||||
# Ask user if they want to convert the model
|
||||
echo ""
|
||||
read -p "Do you want to convert the selected model to the new format? (Y/N)" choice
|
||||
|
||||
if [ "$choice" == "N" ]; then
|
||||
echo ""
|
||||
echo "Model conversion cancelled. Skipping..."
|
||||
exit 0
|
||||
echo ""
|
||||
echo "Model conversion cancelled. Skipping..."
|
||||
else
|
||||
# Convert the model
|
||||
echo "Converting the model to the new format..."
|
||||
if [ ! -d "tmp/llama.cpp" ]; then
|
||||
git clone https://github.com/ggerganov/llama.cpp.git tmp/llama.cpp
|
||||
fi
|
||||
mv -f "${modelPath}" "${modelPath}.original"
|
||||
python tmp/llama.cpp/migrate-ggml-2023-03-30-pr613.py "${modelPath}.original" "${modelPath}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo ""
|
||||
echo "Error during model conversion. Restarting..."
|
||||
mv -f "${modelPath}.original" "${modelPath}"
|
||||
exit 1
|
||||
else
|
||||
echo ""
|
||||
echo "The model file (${modelPath}) has been converted to the new format."
|
||||
fi
|
||||
fi
|
||||
|
||||
The output inside a code tag
|
||||
echo "The code has been converted successfully."
|
||||
;;
|
||||
* ) echo ""
|
||||
echo "Conversion cancelled. Skipping..."
|
||||
;;
|
||||
esac
|
||||
# Convert the model
|
||||
echo ""
|
||||
echo "Converting the model to the new format..."
|
||||
if [ ! -d "tmp/llama.cpp" ]; then
|
||||
git clone https://github.com/ggerganov/llama.cpp.git tmp/llama.cpp
|
||||
fi
|
||||
mv -f "${modelPath}" "${modelPath}.original"
|
||||
python tmp/llama.cpp/migrate-ggml-2023-03-30-pr613.py "${modelPath}.original" "${modelPath}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo ""
|
||||
echo "Error during model conversion. Restarting..."
|
||||
mv -f "${modelPath}.original" "${modelPath}"
|
||||
goto CONVERT_RESTART
|
||||
else
|
||||
echo ""
|
||||
echo "The model file (${modelPath}) has been converted to the new format."
|
||||
goto END
|
||||
fi
|
||||
|
||||
:CANCEL_CONVERSION
|
||||
echo ""
|
||||
echo "Conversion cancelled. Skipping..."
|
||||
goto END
|
||||
|
||||
:END
|
||||
echo ""
|
||||
echo "Cleaning tmp folder"
|
||||
rm -rf "./tmp"
|
||||
|
Loading…
Reference in New Issue
Block a user