Fixes for 12B

This commit is contained in:
2025-05-22 18:51:07 +00:00
parent 19dd9fa2ee
commit c22917e3c9
4 changed files with 23 additions and 17 deletions

View File

@@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
#SIA_INSTALL_NO_WEB=1 SIA_INSTALL_NO_WEB=1
#SIA_INSTALL_NO_LLAMA_CPP=1 SIA_INSTALL_NO_LLAMA_CPP=
#SIA_INSTALL_NO_NOTEBOOK=1 SIA_INSTALL_NO_NOTEBOOK=1
#SIA_INSTALL_NO_CORE=1 SIA_INSTALL_NO_CORE=1
#SIA_INSTALL_NO_ITB=1 SIA_INSTALL_NO_ITB=1
#SIA_INSTALL_NO_MISTRAL_INFER=1 SIA_INSTALL_NO_MISTRAL_INFER=1
#SIA_INSTALL_NO_GEMMA_INFER=1 SIA_INSTALL_NO_GEMMA_INFER=
#SIA_INSTALL_NO_GEMMA_TRAIN=1 SIA_INSTALL_NO_GEMMA_TRAIN=
cd "/root/desktop" cd "/root/desktop"

View File

@@ -8,9 +8,13 @@ version = "0.1.0"
requires-python = ">=3.8" requires-python = ">=3.8"
dependencies = [ dependencies = [
"blobfile>=3.0.0",
"llama-cpp-python @ git+https://github.com/abetlen/llama-cpp-python.git#egg=llama-cpp-python&env=CMAKE_ARGS=-DLLAMA_BUILD=OFF", "llama-cpp-python @ git+https://github.com/abetlen/llama-cpp-python.git#egg=llama-cpp-python&env=CMAKE_ARGS=-DLLAMA_BUILD=OFF",
"llm_engine_utils @ file:///root/sia/lib/llm_engine_utils", "llm_engine_utils @ file:///root/sia/lib/llm_engine_utils",
"protobuf>=6.0.0",
"python-dotenv>=1.0.0", "python-dotenv>=1.0.0",
"sentencepiece>=0.2.0",
"tiktoken>=0.9.0",
"transformers>=4.0.0", "transformers>=4.0.0",
"xml_schema_validator @ file:///root/sia/lib/xml_schema_validator", "xml_schema_validator @ file:///root/sia/lib/xml_schema_validator",
] ]

View File

@@ -8,17 +8,17 @@ version = "0.1.0"
requires-python = ">=3.8" requires-python = ">=3.8"
dependencies = [ dependencies = [
"accelerate==1.4.0", "accelerate==1.2.0",
"bitsandbytes==0.45.3", "bitsandbytes>=0.45.0",
"datasets==3.3.2", "datasets==3.3.2",
"evaluate==0.4.3", "evaluate==0.4.3",
"llm_engine_utils @ file:///root/sia/lib/llm_engine_utils", "llm_engine_utils @ file:///root/sia/lib/llm_engine_utils",
"peft==0.14.0", "peft==0.13.2",
"python-dotenv>=1.0.0", "python-dotenv>=1.0.0",
"sentencepiece>=0.2.0", "sentencepiece>=0.2.0",
"torch>=2.4.0", "torch==2.4.1",
"transformers>=4.51.3", "transformers==4.51.3",
"trl==0.15.2", "trl>=0.17.0",
] ]
[project.scripts] [project.scripts]

View File

@@ -19,6 +19,7 @@ def train(config: Config):
config.model, config.model,
token=config.api_key, token=config.api_key,
trust_remote_code=True, trust_remote_code=True,
use_fast=False,
) )
tokenizer.save_pretrained(config.output_dir/"tokenizer") tokenizer.save_pretrained(config.output_dir/"tokenizer")
@@ -81,12 +82,13 @@ def train(config: Config):
def merge(config: Config): def merge(config: Config):
adapted_model = AutoPeftModelForCausalLM.from_pretrained( adapted_model = AutoPeftModelForCausalLM.from_pretrained(
config.output_dir/"lora_adapter", config.output_dir/"lora_adapter",
torch_dtype=torch.float16, # Use float16 for better compatibility torch_dtype=torch.float16,
device_map="auto",
offload_folder="offload",
token=config.api_key, token=config.api_key,
load_in_4bit=False,
load_in_8bit=False,
) )
merged_model = adapted_model.merge_and_unload() merged_model = adapted_model.merge_and_unload()
merged_model.save_pretrained( merged_model.save_pretrained(
config.output_dir/"merged", config.output_dir/"merged",
safe_serialization=True safe_serialization=True