Thanks for the answer!
Your intuition is right, that’s exactly what I do.
print(weights_df[:10])

output:
       objid  level2     count
0   32756761       0  0.000007
2   32758055      13  0.000463
3   32758988       5  0.000178
5   32760828       0  0.000007
6   32760820       0  0.000007
10  32760656       5  0.000178
11  32760819       1  0.000037
12  32760823       0  0.000007
13  32636402      17  0.001184
15  32761023       5  0.000178

N.B.Labels(level2 is the label) are mapped into integer numbers. Label numbers are sorted according to their frequency in decreasing order. Label 0 is detritus, which is the label with ~100k samples. and label 5 is silks with 5629 samples.
If I print the values instead (which are the ones that I use into the WeightedRandomSampler) that’s what I get.
print(weights_df['count'].values[:10])

[7.22e-06 4.63e-04 1.78e-04 7.22e-06 7.22e-06 1.78e-04 3.71e-05 7.22e-06
 1.18e-03 1.78e-04]

Here I print the tensor:
print(weights[:10])

tensor([7.2234e-06, 4.6296e-04, 1.7764e-04, 7.2234e-06, 7.2234e-06, 1.7764e-04,
        3.7124e-05, 7.2234e-06, 1.1838e-03, 1.7764e-04], dtype=torch.float64)