0

I am trying to upload an SVR model (created with sklearn) to S3 bucket using s3fs, but I get an error saying "TypeError: a bytes-like object is required, not 'SVR'". Can anyone suggest how to transform SVR into the right format?

My code is

model = SVR_model

fs = s3fs.S3FileSystem()
with fs.open('s3://bucket/SVR_model', 'wb') as f:
    f.write(model)
Andrew Gaul
  • 2,296
  • 1
  • 12
  • 19

1 Answers1

1

Use pickle to turn model into a bytes object:

model = pickle.dumps(SVR_model)

fs = s3fs.S3FileSystem()
with fs.open('s3://bucket/SVR_model', 'wb') as f:
    f.write(model)