trainer.vision_causal_language_model_trainer.fwd_bwd_functions
create_vision_casual_language_model_evaluation_step(partition_spec=PartitionSpec(('dp', 'fsdp'), 'sp'))
The create_vision_casual_language_model_evaluation_step function is used to create a function that calculates the loss and accuracy of a model. It takes in a set of parameters, which are then passed into the state.apply_fn function to generate logits for each token in the batch. The cross entropy loss and accuracy are then calculated from these logits.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
partition_spec |
Specify the partitioning of the model parameters |
PartitionSpec(('dp', 'fsdp'), 'sp')
|
Returns:
Type | Description |
---|---|
A function that can be used to calculate the loss and accuracy of a model |
Source code in src/python/easydel/trainer/vision_causal_language_model_trainer/fwd_bwd_functions.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
create_vision_casual_language_model_train_step(partition_spec=PartitionSpec(('dp', 'fsdp'), 'sp'))
The create_vision_casual_language_model_train_step function is a training step function that takes in the current state of the model,and a batch of data. It then calculates the loss and accuracy for this batch, and returns an updated state with new parameters based on these gradients.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
partition_spec |
Specify which devices the model will be split across |
PartitionSpec(('dp', 'fsdp'), 'sp')
|
Returns:
Type | Description |
---|---|
A casual_language_model_train_step function that takes in the current state of the model, |
Source code in src/python/easydel/trainer/vision_causal_language_model_trainer/fwd_bwd_functions.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|