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

Commit4bbca96

Browse files
Santi Adavanisantiatpml
Santi Adavani
authored andcommitted
Added indent for info display
1 parent421af8f commit4bbca96

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
@@ -1017,7 +1017,7 @@ def on_log(self, args, state, control, logs=None, **kwargs):
10171017
logs["step"]=state.global_step
10181018
logs["max_steps"]=state.max_steps
10191019
logs["timestamp"]=str(datetime.now())
1020-
print_info(json.dumps(logs))
1020+
print_info(json.dumps(logs,indent=4))
10211021
insert_logs(self.project_id,self.model_id,json.dumps(logs))
10221022

10231023

@@ -1275,7 +1275,6 @@ def evaluate(self):
12751275

12761276
if"eval_accuracy"inmetrics.keys():
12771277
metrics["accuracy"]=metrics.pop("eval_accuracy")
1278-
12791278

12801279
# Drop all the keys that are not floats or ints to be compatible for pgml-extension metrics typechecks
12811280
metrics= {
@@ -1286,6 +1285,7 @@ def evaluate(self):
12861285

12871286
returnmetrics
12881287

1288+
12891289
classFineTuningTextPairClassification(FineTuningTextClassification):
12901290
def__init__(
12911291
self,
@@ -1313,7 +1313,7 @@ def __init__(
13131313
super().__init__(
13141314
project_id,model_id,train_dataset,test_dataset,path,hyperparameters
13151315
)
1316-
1316+
13171317
deftokenize_function(self,example):
13181318
"""
13191319
Tokenizes the input text using the tokenizer specified in the class.
@@ -1326,13 +1326,20 @@ def tokenize_function(self, example):
13261326
13271327
"""
13281328
ifself.tokenizer_args:
1329-
tokenized_example=self.tokenizer(example["text1"],example["text2"],**self.tokenizer_args)
1329+
tokenized_example=self.tokenizer(
1330+
example["text1"],example["text2"],**self.tokenizer_args
1331+
)
13301332
else:
13311333
tokenized_example=self.tokenizer(
1332-
example["text1"],example["text2"],padding=True,truncation=True,return_tensors="pt"
1334+
example["text1"],
1335+
example["text2"],
1336+
padding=True,
1337+
truncation=True,
1338+
return_tensors="pt",
13331339
)
13341340
returntokenized_example
13351341

1342+
13361343
classFineTuningConversation(FineTuningBase):
13371344
def__init__(
13381345
self,
@@ -1459,7 +1466,7 @@ def formatting_prompts_func(example):
14591466
callbacks=[PGMLCallback(self.project_id,self.model_id)],
14601467
)
14611468
print_info("Creating Supervised Fine Tuning trainer done. Training ... ")
1462-
1469+
14631470
# Train
14641471
self.trainer.train()
14651472

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp