Git Product home page Git Product logo

finetune-deploy-bert-with-amazon-sagemaker-for-hugging-face's Introduction

Finetuning Hugging Face DistilBERT with Amazon Reviews Polarity dataset.

In this demo, we will use the Hugging Faces transformers and datasets library with Amazon SageMaker to fine-tune a pre-trained transformer on binary text classification. In particular, we will use the pre-trained DistilBERT model with the Amazon Reviews Polarity dataset. We will then deploy the resulting model for inference using SageMaker Endpoint.

We'll be using an offshoot of BERT called DistilBERT that is smaller, and so faster and cheaper for both training and inference. A pre-trained model is available in the transformers library from Hugging Face.

The Amazon Reviews Polarity dataset consists of reviews from Amazon. The data span a period of 18 years, including ~35 million reviews up to March 2013. Reviews include product and user information, ratings, and a plaintext review. It's avalaible under the amazon_polarity dataset on Hugging Face.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

finetune-deploy-bert-with-amazon-sagemaker-for-hugging-face's People

Contributors

amazon-auto avatar cyranob avatar philschmid avatar voitau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

finetune-deploy-bert-with-amazon-sagemaker-for-hugging-face's Issues

Unable to complete the training Job

I am trying to run the notebook as it is and getting error mentioned below,

Traceback (most recent call last): File "train.py", line 45, in train_dataset = load_from_disk(args.training_dir) File "/opt/conda/lib/python3.6/site-packages/datasets/load.py", line 797, in load_from_disk return Dataset.load_from_disk(dataset_path, fs, keep_in_memory=keep_in_memory) File "/opt/conda/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 665, in load_from_disk dataset_info = DatasetInfo.from_dict(json.load(dataset_info_file)) File "/opt/conda/lib/python3.6/site-packages/datasets/info.py", line 225, in from_dict return cls({k: v for k, v in dataset_info_dict.items() if k in field_names}) File "", line 18, in init File "/opt/conda/lib/python3.6/site-packages/datasets/info.py", line 137, in post_init self.features = Features.from_dict(self.features) File "/opt/conda/lib/python3.6/site-packages/datasets/features.py", line 947, in from_dict obj = generate_from_dict(dic) File "/opt/conda/lib/python3.6/site-packages/datasets/features.py", line 895, in generate_from_dict return {key: generate_from_dict(value) for key, value in obj.items()} File "/opt/conda/lib/python3.6/site-packages/datasets/features.py", line 895, in return {key: generate_from_dict(value) for key, value in obj.items()} File "/opt/conda/lib/python3.6/site-packages/datasets/features.py", line 899, in generate_from_dict return Sequence(feature=generate_from_dict(obj["feature"]), length=obj["length"]) | Traceback (most recent call last): File "train.py", line 45, in train_dataset = load_from_disk(args.training_dir) File "/opt/conda/lib/python3.6/site-packages/datasets/load.py", line 797, in load_from_disk return Dataset.load_from_disk(dataset_path, fs, keep_in_memory=keep_in_memory) File "/opt/conda/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 665, in load_from_disk dataset_info = DatasetInfo.from_dict(json.load(dataset_info_file)) File "/opt/conda/lib/python3.6/site-packages/datasets/info.py", line 225, in from_dict return cls({k: v for k, v in dataset_info_dict.items() if k in field_names}) File "", line 18, in init File "/opt/conda/lib/python3.6/site-packages/datasets/info.py", line 137, in post_init self.features = Features.from_dict(self.features) File "/opt/conda/lib/python3.6/site-packages/datasets/features.py", line 947, in from_dict obj = generate_from_dict(dic) File "/opt/conda/lib/python3.6/site-packages/datasets/features.py", line 895, in generate_from_dict return {key: generate_from_dict(value) for key, value in obj.items()} File "/opt/conda/lib/python3.6/site-packages/datasets/features.py", line 895, in return {key: generate_from_dict(value) for key, value in obj.items()} File "/opt/conda/lib/python3.6/site-packages/datasets/features.py", line 899, in generate_from_dict return Sequence(feature=generate_from_dict(obj["feature"]), length=obj["length"])

KeyError: 'length'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.