Instructions to use USCchildinterviewinglab/roberta-question-type-classifier-2.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use USCchildinterviewinglab/roberta-question-type-classifier-2.0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="USCchildinterviewinglab/roberta-question-type-classifier-2.0")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("USCchildinterviewinglab/roberta-question-type-classifier-2.0") model = AutoModelForSequenceClassification.from_pretrained("USCchildinterviewinglab/roberta-question-type-classifier-2.0", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from USCchildinterviewinglab/roberta-question-type-classifier-2.0: direct link, hf CLI and curl.
- Browser
- Download file 4.39 kB
-
https://huggingface.co/USCchildinterviewinglab/roberta-question-type-classifier-2.0/resolve/main/README.md
- Command line
-
hf download hf://USCchildinterviewinglab/roberta-question-type-classifier-2.0/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/USCchildinterviewinglab/roberta-question-type-classifier-2.0/resolve/main/README.md
4.39 kB
| license: bsd-3-clause-clear | |
| library_name: transformers | |
| base_model: FacebookAI/roberta-base | |
| tags: | |
| - text-classification | |
| - roberta | |
| - question-classification | |
| # RoBERTa Question-Type Classifier 2.0 | |
| This repository contains a fine-tuned RoBERTa model for classifying interviewer utterances into six question-type categories. | |
| Version 2.0 predicts six categories: | |
| | Code | Question type | | |
| |---|---| | |
| | 0 | Non-question | | |
| | 1 | Option-posing question (yes-no and forced-choice) | | |
| | 2 | Wh-question (directive) | | |
| | 3 | Invitation | | |
| | 4 | Tag question | | |
| | 5 | Do you know/remember question | | |
| ## Access | |
| This model uses gated access. Before downloading the model files, sign in to Hugging Face and accept the access conditions for this repository. | |
| Access requests are automatically approved. | |
| ## Getting the Model | |
| After receiving access, you need to download the model files and notebook to your computer. | |
| ### Option 1: Download from Hugging Face | |
| Open the **Files and versions** tab and use the download button beside each file to download the repository files. | |
| Keep the downloaded files together in one folder. | |
| The folder should contain: | |
| - `roberta_question_type_predictions_public.ipynb` | |
| - `config.json` | |
| - `model.safetensors` | |
| - `vocab.json` | |
| - `merges.txt` | |
| - `special_tokens_map.json` | |
| - `tokenizer_config.json` | |
| Then open the folder in VS Code or another Jupyter-compatible environment and open: | |
| `roberta_question_type_predictions_public.ipynb` | |
| ### Option 2: Download with the Hugging Face CLI | |
| If you have the Hugging Face CLI installed and are signed in, you can download the complete repository with: | |
| ```bash | |
| hf download USCchildinterviewinglab/roberta-question-type-classifier-2.0 --local-dir roberta-question-type-classifier-2.0 | |
| ``` | |
| ### Option 3: Clone with Git | |
| If you are familiar with Git, you can instead clone the repository: | |
| ```bash | |
| git clone https://huggingface.co/USCchildinterviewinglab/roberta-question-type-classifier-2.0 | |
| ``` | |
| Cloning is optional. You do not need to use Git in order to run the classifier. | |
| ## Requirements | |
| - Python 3 | |
| - A Jupyter-compatible environment, such as VS Code with the Python and Jupyter extensions | |
| - A Hugging Face account with access to this model in order to download the repository | |
| The notebook installs the required Python packages for you. | |
| ## Input Format | |
| Your input must be a CSV file containing a column named exactly: | |
| `Question` | |
| Other columns are allowed and will be preserved in the output. | |
| Example: | |
| | Question | | |
| |---| | |
| | Tell me everything that happened. | | |
| | Did you see him? | | |
| | Where did you go? | | |
| ## Running the Notebook | |
| 1. Download or clone this repository. | |
| 2. Open the repository folder in VS Code or another Jupyter-compatible environment. | |
| 3. Open `roberta_question_type_predictions_public.ipynb`. | |
| 4. If prompted to select a kernel: | |
| - Click **Select Kernel**. | |
| - Choose **Python Environments...**. | |
| - Select a Python 3 environment. | |
| If you are using VS Code, make sure the Python and Jupyter extensions are installed. | |
| 5. Place a copy of your CSV file in the same repository folder as the notebook. | |
| 6. Make sure the CSV contains a column named exactly `Question`. | |
| 7. If your file is not named `input.csv`, change `input_file` in Section 2 of the notebook to match your filename. | |
| 8. Run the notebook cells from top to bottom. | |
| The notebook does not overwrite the original file. | |
| By default, predictions are written to: | |
| `input_with_question_type_predictions.csv` | |
| Two columns are added: | |
| - `question_type_code`: numeric prediction from 0–5 | |
| - `question_type_label`: corresponding question-type label | |
| ## Optional: Load the Model Directly with Transformers | |
| Developers can also load the model directly from Hugging Face using the Transformers library instead of using the included notebook. | |
| Because this model uses gated access, the Python environment must be authenticated with a Hugging Face account that has access to the repository. | |
| ```python | |
| from transformers import AutoTokenizer, AutoModelForSequenceClassification | |
| model_id = "USCchildinterviewinglab/roberta-question-type-classifier-2.0" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id) | |
| model = AutoModelForSequenceClassification.from_pretrained(model_id) | |
| ``` | |
| This option is intended for users who want to integrate the classifier into their own Python code or workflow. | |
| ## Citation | |
| Citation information will be added upon publication. |