VenkatManda/KaggleQuestions huggingface dataset:
Category: competition
Question: How to form, manage, and disband teams in a competition?
Answer: Everyone that competes in a Competition does so as a team. A team is a
group of one or more users who collaborate on the competition. Joining a
team of other users around the same level as you in machine learning is
a great way to learn new things, combine your different approaches, and
generally improve your overall score.

It’s important to keep in mind that team size does not affect the limit
on how many submissions you may make to a competition per day: whether
you are a team of one or a team of five, you will have the same daily
submission limit.

When you accept the rules and join a Competition, you automatically do
so as part of a new team consisting solely of yourself. You can then
adjust your team settings in various ways by visiting the “Team” tab on
the Competition page:

You can perform a number of different team-related actions on this tab.

## Types of Team Memberships

There are two team membership statuses. One person serves as the Team
Leader. They are the primary point of contact when we need to
communicate with a team, and also have some additional team modification
privileges (to be discussed shortly). Every other person in the team is
a Member.

If you are the Team Leader you will see a box next to every other team
member’s name on the Team page that says “Make Leader”. You may click on
this at any time to designate someone else on your team the Team Leader.

## Changing your Team Name

The team name is distinct from the names of its members, even if the
team only consists of a single person (yourself). You can always change
your team name to something custom, and other users will see that custom
name when they visit the competition leaderboard. Most teams customize
their names!

Anyone in the team can modify the team name by visiting the Team tab.

## Merging Teams

You may invite another team to your team or, reciprocally, accept a
merge request from another team. If you propose a merger, the merger can
be accepted or rejected by the Team Leader of the other team. If you are
proposed a merger, the Team Leader may choose to accept or reject it.

There are some limits on when you can merge teams:

- Most competitions have a team merger deadline: a point in time by
  which all teams must be finalized. No mergers may occur after this date

- Some competitions specify a maximum team size; you will not be able
  to merge teams whose cumulative number of members exceeds this cap

- You will not be able to merge teams whose combined daily submission
  count exceeds the total submission limit to that date (daily limit x
  number of days).

All of this can be managed through the Team tab.

## Disbanding a Team

Choose your teammates wisely as only teams that have not made any
submissions can be disbanded. This can be done through the Team tab
Category: competition
Question: How does Kaggle handle cheating?
Answer: Cheating is not taken lightly on Kaggle. We monitor our compliance account [the formal channel for reporting cheaters, or appealing a removal for cheating](https://www.kaggle.com/compliance) during competitions. We also spend a considerable amount of time at the close of each competition to review suspicious activity and remove people who have violated the rules from the leaderboard. When we believe we have sufficient evidence, we take action through removal or possibly even an account ban.

We also monitor and investigate moderation reports (plagiarism, voting rings, etc.) throughout the week, and take action as appropriate, which includes removing medals as well as full-out blocking accounts.

If you believe you have evidence that suggests a team violated competition rules, please report it to the Competitions compliance account [here](https://www.kaggle.com/compliance) for a thorough investigation.
Category: gpu
Question: How can I efficiently utilize GPUs on Kaggle? 
Answer: Kaggle provides free access to NVIDIA P100 (16GB) and 2 x T4 (16GB) GPUs. These GPUs are useful for training deep learning models, though they do not accelerate most other workflows (i.e. libraries like pandas and scikit-learn do not benefit from access to GPUs).

You can use up to a quota limit per week of GPU. The quota resets weekly and is 30 hours or sometimes higher depending on demand and resources.

Here are some tips and tricks to get the most of your GPU usage on Kaggle. In general, your most helpful levers will be:

- Only turn on the GPU if you plan on using the GPU. GPUs are only helpful if you are using code that takes advantage of GPU-accelerated libraries (e.g. TensorFlow, PyTorch, etc).
- Actively monitor and manage your GPU usage
- Kaggle has tools for monitoring GPU usage in the settings menu of the Notebooks editor, at the top of the page at kaggle.com/notebooks, on your profile page, and in the session management window.
- Avoid using batch sessions (the commit button) to save or checkpoint your progress. Batch sessions (commits) run all of the code from top to bottom. This is less efficient than simply downloading the .ipynb file from the Notebook editor.
- Cancel unnecessary batch sessions
- The same Notebook can have multiple concurrent batch sessions if you press the commit button prior to completing the first commit. If your latest code has been updated as compared to your previous code, it is likely better for you to cancel that first commit and leave only the 2nd commit running.
- Stop interactive sessions prior to closing the window. Interactive sessions remain active until they reach the 60 minute idle timeout limit. If you stop the session prior to closing your window it can save you up to 60 minutes of compute.
- You can use the Active Events window in the lower left hand corner of your screen to manage your active sessions including stopping unused interactive sessions. Learn more about Active Events [here](https://www.kaggle.com/product-feedback/193925).
- Consider using the Kaggle-API to avoid interactive sessions entirely. With the Kaggle API you can push a new version of your notebook without ever opening up an interactive session in the Notebook editor.

We hope help you get the most from our free GPU compute. Happy Kaggling!
Category: tpu
Question: What is Tensor Processing Units (TPUs)?
Answer: TPUs (TPU-v3) are now available on Kaggle, for free. TPUs are hardware
accelerators specialized in deep learning tasks. They are supported in
Tensorflow 2.1 both through the Keras high-level API and, at a lower
level, in models using a custom training loop.

You can use up to 20 hours per week of TPUs and up to 9h at a time in a
single session.

> If you'd like to jump straight into a sample, here it is: [Five flowers with Keras and Xception on TPU](https://www.kaggle.com/mgornergoogle/five-flowers-with-keras-and-xception-on-tpu).
Category: tpu
Question: How to use  TPU with Keras or TensorFlow?
Answer: Once you have flipped the "Accelerator" switch in your notebook to "TPU v3-8", this is how to enable TPU training in Tensorflow Keras:

```python
# detect and init the TPU
tpu = tf.distribute.cluster_resolver.TPUClusterResolver()

# instantiate a distribution strategy
tf.tpu.experimental.initialize_tpu_system(tpu)
tpu_strategy = tf.distribute.TPUStrategy(tpu)

# instantiating the model in the strategy scope creates the model on the TPU
with tpu_strategy.scope():
    model = tf.keras.Sequential( … )  # define your model normally
    model.compile( … )
    
# train model normally
model.fit(training_dataset, epochs=EPOCHS, steps_per_epoch=…)
```

TPUs are network-connected accelerators and you must first locate them on the network. This is what `TPUClusterResolver.connect()` does.

You then instantiate a `TPUStrategy`. This object contains the necessary distributed training code that will work on TPUs with their 8 compute cores (see hardware section below <#tpuhardware>).

Finally, you use the `TPUStrategy` by instantiating your model in the scope of the strategy. This creates the model on the TPU. Model size is constrained by the TPU RAM only, not by the amount of memory available on the VM running your Python code. Model creation and model training use the usual Keras APIs.
Category: tpu
Question: How to use TPUs with private datasets?
Answer: TPUs work with both public Kaggle Datasets as well as private Kaggle Datasets. The only difference is that if you want to use a private Kaggle Dataset then you need to:

1. Enable “Google Cloud SDK” in the “Add-ons” menu of the notebook editor.
2. Initialize the TPU and then run the “Google Cloud SDK credentials” code snippet.
3. Take note of the Google Cloud Storage path that is returned.

```python
# Step 1: Get the credential from the Cloud SDK
from kaggle_secrets import UserSecretsClient
user_secrets = UserSecretsClient()
user_credential = user_secrets.get_gcloud_credential()

# Step 2: Set the credentials
user_secrets.set_tensorflow_credential(user_credential)

# Step 3: Use a familiar call to get the GCS path of the dataset
from kaggle_datasets import KaggleDatasets
GCS_DS_PATH = KaggleDatasets().get_gcs_path() 
```
Category: tpu
Question: What are the main features of the TPU?
Answer: At approximately 20 inches (50 cm), a TPU v3-8 board is a fairly sizeable piece of hardware. It sports 4 dual-core TPU chips for a total of 8 TPU cores.

Each TPU core has a traditional vector processing part (VPU) as well as dedicated matrix multiplication hardware capable of processing 128x128 matrices. This is the part that specifically accelerates machine learning workloads.

TPUs are equipped with 128GB of high-speed memory allowing larger batches, larger models, and also larger training inputs. In the sample above, you can try using 512x512 px input images, also provided in the dataset, and see the TPU v3-8 handle them easily.
Category: tpu
Question: How to monitor TPU?
Answer: TPU monitor When you are runnig a TPU workload on Kaggle, a performance
monitor appears when you click on the TPU gauge.

The MXU percentage indicates how efficiently the TPU compute hardware is
utilized. Higher is better.

The "Idle Time" percentage measures how often the TPU is sitting idle
waiting for data. You should optimize you data pipeline to make this as
low as possible.

The measurements are refreshed approximately every 10 seconds and only
appear when the TPU is running a computation.
Category: tpu
Question: How to load and save model on TPU?
Answer: When loading and saving TPU models from/to the local disk, the `experimental_io_device` option must be used. The technical explanation is at the end of this section. It can be omitted if writing to GCS because TPUs have direct access to GCS. This option does nothing on GPUs.

## Saving a TPU model locally

```python
save_locally = tf.saved_model.SaveOptions(experimental_io_device='/job:localhost')
model.save('./model', options=save_locally) # saving in Tensorflow's "SavedModel" format
```

## Loading a TPU model from local disk

```python
with strategy.scope():
    load_locally = tf.saved_model.LoadOptions(experimental_io_device='/job:localhost')
    model = tf.keras.models.load_model('./model', options=load_locally) # loading in Tensorflow's "SavedModel" format
```

## Writing checkpoints locally from a TPU model

```python
save_locally = tf.saved_model.SaveOptions(experimental_io_device='/job:localhost')
checkpoints_cb = tf.keras.callbacks.ModelCheckpoint('./checkpoints', options=save_locally)
model.fit(…, callbacks=[checkpoints_cb])
```

## Loading a model from Tensorflow Hub to TPU directly

```python
import tensorflow_hub as hub
with strategy.scope():
    load_locally = tf.saved_model.LoadOptions(experimental_io_device='/job:localhost')
    pretrained_model = hub.KerasLayer('https://tfhub.dev/tensorflow/efficientnet/b6/feature-vector/1', trainable=True, input_shape=[512,512,3], load_options=load_locally)
```

Example in this [EfficientNetB7 Notebook](https://www.kaggle.com/mgornergoogle/efficientnetb7-on-100-flowers#Model).

## `experimental_io_device` explained

To understand what the `experimental_io_device='/job:localhost'` flag does, some background info is needed first. TPU users will remember that in order to train a model on TPU, you have to instantiate the model in a `TPUStrategy` scope. Like this:

```python
# connect to a TPU and instantiate a distribution strategy
tpu = tf.distribute.cluster_resolver.TPUClusterResolver(tpu='local')
tf.tpu.experimental.initialize_tpu_system(tpu)
tpu_strategy = tf.distribute.TPUStrategy(tpu)

# instantiate the model in the strategy scope
with tpu_strategy.scope():
    model = tf.keras.Sequential( … )
```

This boilerplate code actually does 2 things:

1. The strategy scope instructs Tensorflow to instantiate all the variables of the model in the memory of the TPU.
2. The `TPUClusterResolver.connect()` call automatically enters the TPU device scope which instructs Tensorflow to run Tensorflow operations on the TPU.

Now if you call `model.save('./model')` when you are connected to a TPU, Tensorflow will try to run the save operations on the TPU and since the TPU is a network-connected accelerator that has no access to your local disk, the operation will fail. Notice that saving to GCS will work though. The TPU does have access to GCS.

If you want to save a TPU model to your local disk, you need to run the saving operation on your local machine and that is what the `experimental_io_device='/job:localhost'` flag does.
Category: tpu
Question: How to use TPU in competitions?
Answer: Due to technical limitations for certain kinds of code-only competitions we aren’t able to support notebook submissions that run on TPUs, made clear in the competition's rules. But that doesn’t mean you can’t use TPUs to train your models!

A workaround to this restriction is to run your model training in a separate notebook that uses TPUs, and then to save the resulting model. You can then load that model into the notebook you use for your submission and use a GPU to run inference and generate your predictions.

Here’s how that would work in practice:

## Step 1: Save the Model

```python
# Save your model to disk using the .save() functionality. Here we save in .h5 format
# This step will be replaced with an alternative call to save models in Tensorflow 2.3
model.save('model.h5')
```

## Step 2: Put your model in a dataset

You can easily create a dataset from the output of your notebook from the dataviewer. For more details, you can see our [Dataset Documentation](https://www.kaggle.com/docs/datasets#creating-a-dataset).

## Step 3: Load your model into inference Notebook

```python
# You can now load your model and run inference using a GPU in this notebook.
# Because this notebook only uses a GPU, you can submit it to competitions
model = tf.keras.models.load_model('../input/yourDataset/model.h5')
```

## More information and tutorials

A hands-on TPU tutorial containing more information, best practices and samples is available here: [Keras and modern convnets, on TPUs](https://codelabs.developers.google.com/codelabs/keras-flowers-tpu/).

You can also check out our TPU video tutorial, [Learn With Me: Getting Started With TPUs](https://youtu.be/1pdwRQ1DQfY), on our [YouTube channel](https://www.youtube.com/kaggle)!

## TPU playground competition

We have prepared a dataset of 13,000 images of flowers for you to play with. You can give TPUs a try in this playground competition: [Flower Classification with TPUs](https://www.kaggle.com/c/flower-classification-with-tpus).

For an easy way to begin, check out this tutorial notebook and starter project, a part of our Deep Learning course:

* [Getting Started with Petals to the Metal](https://www.kaggle.com/ryanholbrook/create-your-first-submission)
* [Starter Project: Create Your First Submission](https://www.kaggle.com/kernels/fork/10204702)
Category: model
Question: What is Kaggle Models?
Answer: [Kaggle Models](https://www.kaggle.com/models) provides a way to discover, use, and (soon) share public pre-trained models for machine learning. Kaggle Models is a repository of TensorFlow and PyTorch pre-trained models that are easy to use in Kaggle Competition notebooks. Like Datasets, Kaggle Models will also organize community activity which will enrich models' usefulness; every model page will contain discussions, public notebooks, and usage statistics like downloads and upvotes that make models more useful.

Kaggle Models is a new product which the Kaggle team will continue to develop and improve based on what the community would like to see. If you'd like to make suggestions for improvements or new features or report bugs, we recommend you create a new topic on the [Product Feedback forum](https://www.kaggle.com/discussions/product-feedback/new).
Category: model
Question: Where do Models come from?
Answer: Currently, Kaggle Models come from curated sources. In the future, we will add publishing capabilities so anyone who wants to release a model can do so. In the meantime, if you'd like to suggest a new curated source, you can either post a request on the [Product Feedback forum](https://www.kaggle.com/discussions/product-feedback/new) or submit a response to this [Google Form](https://forms.gle/7LMF6f4wfGmoUTcm8) for our team to review. Alternatively, if you publish a model on TensorFlow Hub, it will be automatically synced to Kaggle Models.
Category: model
Question: How to find Kaggle Models?
Answer: You can find Kaggle Models by using the [Models landing page](https://www.kaggle.com/models). There are a number of filters and sorts plus free text search. For instances you can search by:

- Filtering to TensorFlow models
- Filtering by the task tag you want (e.g., classification)
- Filtering by model size
- Searching "BERT" in the free text search
- Sorting by number of upvotes
- Etc.

You may also want to peruse competitions to see what models are performing well or are otherwise popular for tasks relevant to your use case. Competitors commonly share which models they're using in public notebooks and in discussion write-ups. When you fork a notebook that has a model from Kaggle Models attached to it, your copy will also have the same model attached.

Finally, you can also search for models from within the notebook editor. Use the "Add Models" component in the right-hand pane of the editor to search and attach models to your notebooks. This works similarly to Datasets.
Category: model
Question: What is in the model detail page?
Answer: When you click on a model you will be taken to the "detail page" for that model. For example, this is the detail page for a [BERT model](https://www.kaggle.com/models/google/bert). The model detail page contains an overview tab with a Model Card (metadata and information about how the model was trained, what its acceptable use cases are, any limitations, etc.), a framework and variation explorer, and a usage dashboard. There are tabs for notebooks and discussions. If a model is useful, you can upvote it.

Beyond the overall metadata, a model detail page also organizes all variations and frameworks for a given model. For example:

- **Variations**: The same model with different numbers of parameters, e.g., small, medium, and large.
- **Frameworks**: The same model with different ML library compatibility, e.g., TensorFlow, PyTorch, etc.

You can view and use the specific framework and variation that you want by selecting it in the file explorer on the overview page beneath the Model Card. From here, you can use click "New Notebook" to attach it to a new notebook to start using the model.
Category: model
Question: How to use Kaggle Models?

Answer: Currently, Kaggle Models are most useful within the context of Competitions, specifically for use within Notebooks. Start by either forking a notebook that has a model attached (you can view the attached models on the "Input" tab of any notebook), creating a new notebook on a model, or adding a model to a new notebook from the right-hand pane of the editor.

You’ll be prompted to confirm your framework and model variation(s), then simply copy and paste the starter code to load the model.
Category: model
Question: How to create Kaggle Models?
Answer: Currently, Kaggle Models is a repository of model sources curated by Kaggle Team. In the future, anyone will be able to share a model to Kaggle Models for use in Competition notebooks and beyond. In the meantime, if you'd like to suggest a new curated source, you can either post a request on the [Product Feedback forum](https://www.kaggle.com/discussions/product-feedback/new) or submit a response to this [Google Form](https://forms.gle/7LMF6f4wfGmoUTcm8) for our team to review. Alternatively, if you publish a model on TensorFlow Hub, it will be synced to Kaggle Models as long as it uses an Apache 2.0, MIT, or CC0 license type.
Category: noteboook
Question: What is Kaggle Notebooks?
Answer: A cloud computational environment that enables reproducible and collaborative
analysis to explore and run machine learning code.
Category: noteboook
Question: What are the different types of notebooks available on Kaggle?
Answer: There are two different types of Notebooks on Kaggle.

## Scripts

The first type is a script. Scripts are files that execute everything as code sequentially. To start a script, click on “Create Notebook” and select “Script”. This will open the Scripts editing interface.

From here you may select what type of script you would like to execute. You may write scripts in R or in Python.

You can also execute selected lines of code by highlighting the code in the editor interface and clicking the “Run” button or hitting shift-enter. Any results will be printed to the console.

“[Deep Learning Support [.9663]](https://www.kaggle.com/alexanderkireev/deep-learning-support-9663)” from the [TalkingData AdTracking Fraud Detection Challenge](https://www.kaggle.com/c/talkingdata-adtracking-fraud-detection) is a great example of a Script-type.

### RMarkdown Scripts

RMarkdown scripts are a special type of script that executes not just R code, but RMarkdown code. This is a combination of R code and Markdown editing syntax that is preferred by most R authors in our community.

The RMarkdown editor is the same one used for basic R or Python scripts, except that it uses the special RMarkdown syntax. To start editing an RMarkdown script, click on “Create Notebook”, navigate to the “Scripts” pane, and click on that. Then, in the language dropdown, click on “RMarkdown”.

“[Head Start for Data Science](https://www.kaggle.com/hiteshp/head-start-for-data-scientist)” is a great example of a RMarkdown Script-type.

## Notebooks

The last type is Jupyter notebooks (usually just “notebooks”). Jupyter notebooks consist of a sequence of cells, where each cell is formatted in either Markdown (for writing text) or in a programming language of your choice (for writing code). To start a notebook, click on “Create Notebook”, and select “Notebook”. This will open the Notebooks editing interface.

Notebooks may be written in either R or Python.

“[Comprehensive data exploration with Python](https://www.kaggle.com/pmarcelino/comprehensive-data-exploration-with-python)” is a great example of a Python Jupyter Notebook-type. “[How to Become a Data Scientist](https://www.kaggle.com/jackcook/how-to-become-a-data-scientist)” is a great example of an R Jupyter Notebook-type.