mod
This commit is contained in:
parent
4014b12ab4
commit
c42a4f6f9a
8
hft.py
8
hft.py
|
|
@ -12,9 +12,6 @@ import json
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from huggingface_hub import login
|
from huggingface_hub import login
|
||||||
|
|
||||||
import torch
|
|
||||||
torch.cuda.empty_cache()
|
|
||||||
|
|
||||||
login(token="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")
|
login(token="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")
|
||||||
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
||||||
|
|
||||||
|
|
@ -164,7 +161,7 @@ tokenized_dataset = dataset.map(tokenize_function, batched=True, batch_size=8)
|
||||||
# Inicjalizacja modelu
|
# Inicjalizacja modelu
|
||||||
config = AutoModelForCausalLM.from_pretrained(model_name).config
|
config = AutoModelForCausalLM.from_pretrained(model_name).config
|
||||||
model = CustomModel.from_pretrained(model_name, config=config)
|
model = CustomModel.from_pretrained(model_name, config=config)
|
||||||
model.gradient_checkpointing_enable()
|
model.to("cpu")
|
||||||
|
|
||||||
# Konfiguracja treningu
|
# Konfiguracja treningu
|
||||||
training_args = TrainingArguments(
|
training_args = TrainingArguments(
|
||||||
|
|
@ -177,8 +174,7 @@ training_args = TrainingArguments(
|
||||||
logging_steps=100,
|
logging_steps=100,
|
||||||
save_strategy="steps",
|
save_strategy="steps",
|
||||||
save_steps=1000,
|
save_steps=1000,
|
||||||
report_to="none",
|
report_to="none"
|
||||||
gradient_checkpointing=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Trening
|
# Trening
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue