You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should try to converge to something that roughly looks like this for our scripts:
#!/usr/bin/env python3"""Train my model on a dataset."""fromdataclassesimportdataclass, fieldfromdatasetsimportload_datasetfromtransformersimportAutoConfig, HfArgumentParser, Trainer, TrainingArgumentsfrommy_modelimportMyModel@dataclassclassModelArguments:
""" Arguments pertaining to which model/config we are going to train from. """model_name_or_path: str=field(
metadata={"help": "Path to pretrained model or model identifier from huggingface.co/models"}
)
trust_remote_code: bool=field(
default=False,
metadata={
"help": (
"Whether or not to allow for custom models defined on the Hub in their own modeling files. This option""should only be set to `True` for repositories you trust and in which you have read the code, as it ""will execute code present on the Hub on your local machine."
)
},
)
@dataclassclassDataTrainingArguments:
""" Arguments pertaining to what data we are going to input our model for training and eval. """defmain():
parser=HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments))
model_args, data_args, training_args=parser.parse_args_into_dataclasses()
# Load the model and the processorconfig=AutoConfig.from_pretrained(
model_args.model_name_or_path,
trust_remote_code=model_args.trust_remote_code,
)
model=MyModel(config)
# Load the datasetdataset=load_dataset("my_dataset")
# Traintrainer=Trainer(model=model, args=training_args, train_dataset=dataset)
trainer.train()
if__name__=="__main__":
main()
The text was updated successfully, but these errors were encountered:
We should try to converge to something that roughly looks like this for our scripts:
The text was updated successfully, but these errors were encountered: