Kaggle / kagglehub

Python library to access Kaggle resources
Apache License 2.0
49 stars 9 forks source link

Model upload #43

Closed mohami2000 closed 9 months ago

mohami2000 commented 9 months ago

Implements functionality for kagglehub users to be able to upload models: https://buganizer.corp.google.com/issues/312511716

rosbo commented 9 months ago

Don't forget to also test that it actually works against the real server and adjust the fake accordingly:

# replace `rosebv` with your Kaggle username and put the path to use a path to your own directory with model file
hatch run python -c "import kagglehub; kagglehub.model_upload('rosebv/test-kagglehub/pyTorch/dot', '/usr/local/google/home/rosbo/Documents/test-model', 'Apache 2.0', 'model_type')"

Currently the call to /blobs/upload returns {'code': 500, 'message': 'InternalServerError'} for instance.

mohami2000 commented 9 months ago

Don't forget to also test that it actually works against the real server and adjust the fake accordingly:

# replace `rosebv` with your Kaggle username and put the path to use a path to your own directory with model file
hatch run python -c "import kagglehub; kagglehub.model_upload('rosebv/test-kagglehub/pyTorch/dot', '/usr/local/google/home/rosbo/Documents/test-model', 'Apache 2.0', 'model_type')"

Currently the call to /blobs/upload returns {'code': 500, 'message': 'InternalServerError'} for instance.

Hmm, I already did and just did again. it works for me. this is what i ran:

hatch run python -c "import kagglehub; kagglehub.model_upload('aminmohamed/test-kagglehub/pyTorch/dot', '/usr/local/google/home/aminmohamed/NegBio/images', 'Apache 2.0')"

this is the output: Starting upload for file negbio.png Upload successful: negbio.png (27KB) Model Instance for 'aminmohamed/test-kagglehub/pyTorch/dot' Created.

mohami2000 commented 9 months ago

Actually, creating a new model instance works.

However, creating a new model instance version fails:

I added a print statement to debug and it returns a 500:

hatch run python -c "import kagglehub; kagglehub.model_upload('rosebv/test-kagglehub/pyTorch/dot', '/usr/local/google/home/rosbo/Documents/test-model', 'Apache 2.0')"
Starting upload for file dot.png
Upload successful: dot.png (150B)
ROSBO: {'code': 500, 'message': 'InternalServerError'}
Model Instance Version for 'rosebv/test-kagglehub/pyTorch/dot' Created.

should be fixed now :)