File size: 912 Bytes
6cca118 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import os
# Get the current working directory
path = os.getcwd()
# Read the template file
with open(
os.path.join(path, "SFT_Model", "supervisor", "ModelFile_tem.txt"), "r"
) as file:
data = file.read()
# Replace the placeholder with the actual path
data = data.replace(
"{path}",
os.path.join(path, "SFT_Model", "supervisor", "model.gguf").replace("\\", "/"),
)
print(data)
# Write the modified data to a new file
with open(
os.path.join(path, "SFT_Model", "supervisor", "ModelFile.txt"), "w"
) as file:
file.write(data)
# Running the ollama setup
print("Running the ollama setup \n \n")
# Construct the command
path = path.replace("\\", "/") # Replace backslashes with forward slashes
script = f'ollama create myllama2 --file "{path}/SFT_Model/supervisor/ModelFile.txt"'
print(script)
os.system(script)
|