Instructions to use Belldofers/BelldofersTestModel with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- AllenNLP
How to use Belldofers/BelldofersTestModel with AllenNLP:
import allennlp_models from allennlp.predictors.predictor import Predictor predictor = Predictor.from_path("hf://Belldofers/BelldofersTestModel") predictor_input = {"passage": "My name is Wolfgang and I live in Berlin", "question": "Where do I live?"} predictions = predictor.predict_json(predictor_input) - Notebooks
- Google Colab
- Kaggle
| import sagemaker | |
| from sagemaker.huggingface import HuggingFace | |
| # gets role for executing training job | |
| role = sagemaker.get_execution_role() | |
| hyperparameters = { | |
| 'model_name_or_path':'EleutherAI/gpt-j-6B', | |
| 'output_dir':'/opt/ml/model' | |
| # add your remaining hyperparameters | |
| # more info here https://github.com/huggingface/transformers/tree/v4.17.0/examples/pytorch/language-modeling | |
| } | |
| # git configuration to download our fine-tuning script | |
| git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.17.0'} | |
| # creates Hugging Face estimator | |
| huggingface_estimator = HuggingFace( | |
| entry_point='run_clm.py', | |
| source_dir='./examples/pytorch/language-modeling', | |
| instance_type='ml.p3.2xlarge', | |
| instance_count=1, | |
| role=role, | |
| git_config=git_config, | |
| transformers_version='4.17.0', | |
| pytorch_version='1.10.2', | |
| py_version='py38', | |
| hyperparameters = hyperparameters | |
| ) | |
| # starting the train job | |
| huggingface_estimator.fit() |