stanfordnlp / pyreft

ReFT: Representation Finetuning for Language Models
https://arxiv.org/abs/2404.03592
Apache License 2.0
1.12k stars 93 forks source link

[P1] TypeError: Object of type type is not JSON serializable #106

Closed ajayspatil7 closed 3 months ago

ajayspatil7 commented 3 months ago

TypeError Traceback (most recent call last)

in () 1 # Train the model!! ----> 2 _ = trainer.train() 12 frames /usr/lib/python3.10/json/encoder.py in default(self, o) 177 178 """ --> 179 raise TypeError(f'Object of type {o.__class__.__name__} ' 180 f'is not JSON serializable') 181 TypeError: Object of type type is not JSON serializable
frankaging commented 3 months ago

@ajayspatil7 hey! please follow this issue to see if you can fix this: https://github.com/stanfordnlp/pyreft/issues/69

basically, you could not use tensorboard right now with this repo; you can have to set --report_to none. thanks!

ajayspatil7 commented 3 months ago

Yeah but, what if I'm running it using notebook ? Till the last cell it's running properly but, trainer.train() methods fails. And, produces this error.

frankaging commented 3 months ago

@ajayspatil7 what's your training args?

training_args = transformers.TrainingArguments(
    num_train_epochs=100.0, output_dir="./tmp", per_device_train_batch_size=10, 
    learning_rate=4e-3, logging_steps=40, report_to=[])

did you set report_to=[]? and could you also check your transformers lib version? mine is 4.39.3.

ajayspatil7 commented 3 months ago

Hey. I've downgraded my transformers version and it's working quite impressive! Thanks.