Troubleshooting

Duplicate Keys when Generating a Json from a Dictionary in Python

TLDR: A dictionary in json treats all keys as string, while a python dict distinguishes not only between the content but also its datatype (see stackoverflow). When saving a dictionary into a json and reloading the dictionary from it, you have to be careful not to implicitely convert the original numeric key into a key …

Duplicate Keys when Generating a Json from a Dictionary in Python Read More »

PyTorch – expected scalar type Float but found Double

TLDR: The default datatype of a numpy array translates to double/float64. If a Tensor is created from that array using torch.as_tensor it will adopt that datatype, which is not compatible with the default datatype of a neural network model which is float32. Using that tensor as input to the nn model will result in the …

PyTorch – expected scalar type Float but found Double Read More »

Training languagemodel – RuntimeError the expanded size of the tensor (100) must match the existing size (64) at non singleton dimension 1.

Context I trained a new languagemodel from scratch using huggingface’ framework and a preconfiguration of Roberta Model on a custom dataset. Now i wanted to vectorize a new dataset using the pretrained model. Observation I receive an error: Resolution This error appears, because the languagemodel trained utilized a maximum document length of 64. However the …

Training languagemodel – RuntimeError the expanded size of the tensor (100) must match the existing size (64) at non singleton dimension 1. Read More »

SentenceTransformer – float object is not subscriptable

TLDR: np.nan objects are of type float Observation I was trying to apply the SentenceTransformer (v2.2.0) on a list of custom documents to create embeddings for each of them, however i would get the error “TypeError: ‘float’ object is not subscriptable“. The traceback refered to the tokenize function, so let’s have a closer look. Explanation …

SentenceTransformer – float object is not subscriptable Read More »

hungsblog | Nguyen Hung Manh | Dresden
Scroll to Top