Run this model with HF Jobs
Run abhitopia/question-answer-generation on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/abhitopia/question-answer-generation. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/abhitopia/question-answer-generation on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use abhitopia/question-answer-generation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use abhitopia/question-answer-generation with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("abhitopia/question-answer-generation") model = AutoModelForSeq2SeqLM.from_pretrained("abhitopia/question-answer-generation", device_map="auto") - Notebooks
- Google Colab
- Kaggle
abhitopia commited on
Commit ·
5b49d65
1
Parent(s): 4383992
better logging
Browse files7 unmodified lines89101111121314151617181920212223242526272829302 unmodified lines33343536373839407 unmodified lines
def model_fn(model_dir): logger.info(f"model_dir: {model_dir}") logging.info('[### model_fn ###] Loading model from {}'.format(model_dir)) model = QAGeneratorPipeline(model_dir=model_dir, use_cuda=True) return model
def predict_fn(input_data, model): logging.info('[### predict_fn ###] Entering predict_fn() method') logger.info("input text: {}".format(input_data)) prediction = model(input_data) logger.info("prediction: {}".format(input_data))
def input_fn(serialized_input_data, content_type=JSON_CONTENT_TYPE): logging.info('[### input_fn ###] Entering input_fn() method') logging.info('[### input_fn ###] request_content_type: {}'.format(content_type)) logging.info('[### input_fn ###] request_body: {}'.format(type(serialized_input_data)))
if content_type == JSON_CONTENT_TYPE: input_data = json.loads(serialized_input_data) return input_data2 unmodified lines
def output_fn(prediction_output, accept=JSON_CONTENT_TYPE): logging.info('[### output_fn ###] Entering output_fn() method') logging.info('[### output_fn ###] prediction: {}'.format(prediction_output)) if accept == JSON_CONTENT_TYPE: return json.dumps(prediction_output), accept raise Exception('Unsupported Content Type')code/inference.py+8-1