I am trying to impement this code federated-ml/network-threat-detection-using-federated-learning.ipynb at master · tuhinsharma121/federated-ml · GitHub 1
while creating these pytorch sensor
X = final_df.values
y = df['Target'].values

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.4, random_state=42)
train_inputs = torch.tensor(X_train,dtype=torch.float).tag("#iot", "#network","#data","#train")
train_labels = torch.tensor(y_train).tag("#iot", "#network","#target","#train")
test_inputs = torch.tensor(X_test,dtype=torch.float).tag("#iot", "#network","#data","#test")
test_labels = torch.tensor(y_test).tag("#iot", "#network","#target","#test")

i got these errors current_tensor = hook_self.torch.native_tensor(*args, **kwargs) TypeError: can’t convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, int64, int32, int16, int8, uint8, and bool. how to resolve this
I tried this code by reading other stack questions

train_inputs = torch.tensor(X_train.astype(np.float32)).tag("#iot", “#network”,"#data","#train")
train_labels = torch.tensor(y_train).tag("#iot", “#network”,"#target","#train")
test_inputs = torch.tensor(X_test.astype(np.float32)).tag("#iot", “#network”,"#data","#test")
test_labels = torch.tensor(y_test).tag("#iot", “#network”,"#target","#test"
but then it gives error ValueError: could not convert string to float: ‘Total Fwd Packets’ Total Fwd Packets is my first feature name. Any recommendation

I also followed other threads

train_inputs = torch.tensor(X_train.to_numpy()).tag("#iot", “#network”,"#data","#train")
but got this error
train_inputs = torch.tensor(X_train.to_numpy()).tag("#iot", “#network”,"#data","#train")

but got this error
train_inputs = torch.tensor(X_train.to_numpy()).tag("#iot", “#network”,"#data","#train") AttributeError: ‘numpy.ndarray’ object has no attribute ‘to_numpy’