Fastai_v1, adding features

(Abner Ayala-Acevedo) #103

One feature I would recommend is split_by_pct() currently there is only random_split_by_pct() which is more practical but sometimes you just want to just use the last 20% as opposed to random and this way you don’t have to manually find the index in the list that will make the split work. you just say the percentage and the method figures out how to split it 80/20.

Another request will be not to deprecate from single_folder. Sometimes your train and validation folder can be very differently organized or from different distributions. I would like to be able to create a data_bunch and say this is the validation dataset so that it only uses validation transforms. Then we can merge it with a separate training data_bunch or something along this lines.

(Juri Wiens) #104

In my experiments I’m using the SaveModelCallback as my default mechanism for saving models. However, it is often difficult for me to manually track metadata of the resulting models such as hyper parameters, metrics and the used fastai version. The CSV Logger records the training history, but I can’t tell at first which epoch my model was saved in and which metrics apply for the saved model. For this reason I implemented a SaveMetadataCallback, which I use as a supplement to the SaveModelCallback:
It’s a first simple version that saves some basic metadata like metrics and library/python versions. The metadata can easily be extended by specifying a base_metadata dict.

It allows me to use DVC for metric tracking.

Do you think the feature is interesting enough to be included in the fastai library? If so, I would prepare a PR.

(Kerem Turgutlu) #105

I feel like if your data is ordered it’s probably in a csv or df. So both ways it will allow to use from_df() and create a df object. The solution would be simple as:


or if there is only itemlist

.split_by_idx(valid_idx: np.arange(len(items))[-int(len(items)*0.2):] )

I believe the reason of not having a split_by_pct is basically it being a repetition of already existing methods which will allow you to do the desired thing.

Hope this helps

(Ricardo Herrmann) #106

Hi everyone. Are there any plans to include MixedTabular (article and code) in the base library in the short foreseeable future?

(Ricardo Herrmann) #107

The good part about integrating SentencePiece is that it can be used as a transformation to augment text data and also to do TTA (Test-Time Augmentation). However, when I tried that, I couldn’t get good GPU utilization anymore and for now I’m using it just as a pre-processor. It’s something that’s definitely worth integrating to the base library though.

(Ricardo Herrmann) #108

I’m submitting a pull request with a patch that lets users of AWD-LSTM to use pre-computed embeddings as an alternative input (other than tensors with token IDs).This is useful is a few cases, such as computing the sequential Jacobian to inspect the intrinsic attention (sensitivity) over elements of the input sequence. The pull request also includes this new TextClassificationInterpretation class, which is still a bit limited but can already be useful to someone else.

Example (even though the colors are not very indicative in this example because it’s using an untrained model):

Regarding visualization, currently colormaps and the separator are configurable (the default is a RdYlGn cmap and one can make the separator the empty string if using char-level models).

Let me know your thoughts. Thanks in advance!

(Ricardo Herrmann) #109

The fastai.tabular package already provides a way to generate date/time features (the add_datepart function), but another useful representation is mapping components to the circle, by taking the sine and cosine parts of modular components of date/time cycles (days of the week, month of the year, etc.). This is know by many names like trigonometric time, cyclic time features, and so on.

I’m submitting the add_cyclic_datepart function, with a similar form of use: