Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit189e9f0

Browse files
author
Santi Adavani
committed
Added indent for info display
1 parentcf66c0c commit189e9f0

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

‎pgml-extension/src/bindings/transformers/transformers.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ def on_log(self, args, state, control, logs=None, **kwargs):
990990
logs["step"]=state.global_step
991991
logs["max_steps"]=state.max_steps
992992
logs["timestamp"]=str(datetime.now())
993-
print_info(json.dumps(logs))
993+
print_info(json.dumps(logs,indent=4))
994994
insert_logs(self.project_id,self.model_id,json.dumps(logs))
995995

996996

@@ -1248,7 +1248,6 @@ def evaluate(self):
12481248

12491249
if"eval_accuracy"inmetrics.keys():
12501250
metrics["accuracy"]=metrics.pop("eval_accuracy")
1251-
12521251

12531252
# Drop all the keys that are not floats or ints to be compatible for pgml-extension metrics typechecks
12541253
metrics= {
@@ -1259,6 +1258,7 @@ def evaluate(self):
12591258

12601259
returnmetrics
12611260

1261+
12621262
classFineTuningTextPairClassification(FineTuningTextClassification):
12631263
def__init__(
12641264
self,
@@ -1286,7 +1286,7 @@ def __init__(
12861286
super().__init__(
12871287
project_id,model_id,train_dataset,test_dataset,path,hyperparameters
12881288
)
1289-
1289+
12901290
deftokenize_function(self,example):
12911291
"""
12921292
Tokenizes the input text using the tokenizer specified in the class.
@@ -1299,13 +1299,20 @@ def tokenize_function(self, example):
12991299
13001300
"""
13011301
ifself.tokenizer_args:
1302-
tokenized_example=self.tokenizer(example["text1"],example["text2"],**self.tokenizer_args)
1302+
tokenized_example=self.tokenizer(
1303+
example["text1"],example["text2"],**self.tokenizer_args
1304+
)
13031305
else:
13041306
tokenized_example=self.tokenizer(
1305-
example["text1"],example["text2"],padding=True,truncation=True,return_tensors="pt"
1307+
example["text1"],
1308+
example["text2"],
1309+
padding=True,
1310+
truncation=True,
1311+
return_tensors="pt",
13061312
)
13071313
returntokenized_example
13081314

1315+
13091316
classFineTuningConversation(FineTuningBase):
13101317
def__init__(
13111318
self,
@@ -1432,7 +1439,7 @@ def formatting_prompts_func(example):
14321439
callbacks=[PGMLCallback(self.project_id,self.model_id)],
14331440
)
14341441
print_info("Creating Supervised Fine Tuning trainer done. Training ... ")
1435-
1442+
14361443
# Train
14371444
self.trainer.train()
14381445

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp