Bold by length: reduced completion without changing sample weights
Short records are added to the maximum length of the batch, without regard to the random mixing of long sequences.
Learning objectives and first steps2 objectives 2 first fixes
Try to do it after reading
- Estimates of padding costs for different batches
- Check the drums to change the distribution of training
Suggested first
- Target function to oversee learning
- Basic training and validation cycle
Same record, grouping changes calculation
Short records are added to the maximum length of the batch, without regard to the random mixing of long sequences. The number of batches of close records by length can be reduced by reducing the number of invalid cells. This changes the computing organization, which cannot automatically change the weight of each sample in the target, nor can the padding reduction be directly referred to as model effects enhancement.
Four series lengths are [2,3,9,10], batch size 2. If combined with [2,10] and [3,9], the total number of cells is 20+18 = 38, effective position 24, completed; Add[2,3] to [9,10], total grid number 620=26, complete 2. The valid information is the same and the costs of matching it are different.
The size of the main matrix, which is concentrated from the point of view, may also grow in square terms with the length of time. The two previous batches were 100 + 81 = 181 and the latter 9 + 100 = 109. The actual cost is also influenced by batches, head count and kernels, and the square item ratio cannot be used as an acceleration guarantee for equipment.
The drums can also change the order
Length may be associated with activity, labelling and difficulty. Each round is always short to long training, with course sequencing implications, not just a reduction of padding. (c) The rules for cross-sectional sampling can be maintained by disrupting and disrupting the drum order within the drums; Long sequence tails cannot be thrown away for a neat batch.
The dynamic token budget makes the number of samples different. If each batch of loss first sample the average of the original and then equal rights are accumulated, the sample in the smaller batch may be given a higher weight. The calculation should be based on the sample number of the original target or the valid token number, and faster should not be a reason to ignore the denominator.
Projections are sorted by length and the order of labels is restored. Keep a stable sample number or invert, and do not just sort by length again, because the same length exists in parallel. Each record may be exported with identifiable fixed output, and whether it corresponds to each article before and after the inspection group.
This section is a non-framework-related data organizing principle. The interface refers to the current TensorFlow2 and PyTorch2. 38, 26 is a hand job. Performance reports should be accompanied by an effective workload, a proportion of them completed, peak memory and target attribution, and should not include a “batch per second” as the sole conclusion.
Value recovery
lengths=[2,3,9,10]assert 2*10+2*9-sum(lengths) == 14assert 2*3+2*10-sum(lengths) == 2[2,3] and [9,10] How many completes?
Total cell 26 minus validity 24, get 2.
The batch sizes after the drums are different. Why recheck the loss denominator?
The average weight of the equal rights average changes the weight of the single sample, which should be combined with a clear sample or token unit.
Sources and reconciliations
Definitions, methods and interfaces are available.
Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.