Skip to content

Commit

Permalink
Merge branch 'keras-team:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidriasat authored Aug 6, 2023
2 parents f6fc2f1 + 74c7629 commit 34a4dd1
Show file tree
Hide file tree
Showing 63 changed files with 9,411 additions and 2,649 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/stale-issues-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ jobs:
pull-requests: write
steps:
- name: Awaiting response issues
uses: actions/stale@v5
uses: actions/stale@v7
with:
#Limit the No. of API calls in one run default value is 30.
operations-per-run: 500
days-before-issue-stale: 14
days-before-issue-close: 14
stale-issue-label: "stale"
Expand All @@ -30,8 +32,10 @@ jobs:
close-pr-message: "This PR was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further."
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Contribution issues
uses: actions/stale@v5
uses: actions/stale@v7
with:
#Limit the No. of API calls in one run default value is 30.
operations-per-run: 500
days-before-issue-stale: 180
days-before-issue-close: 365
stale-issue-label: "stale"
Expand Down
6 changes: 3 additions & 3 deletions contributor_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ you should import the following:

```python
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import keras
from keras import layers
```

Then access objects from these modules:
Expand All @@ -46,7 +46,7 @@ layers.Layer(...)
layers.Conv2D(...)
```

Note: do **not** use `import keras`. Use `from tensorflow import keras` instead.
Note: As of `2.13` prefer `import keras` over `from tensorflow import keras`.


### Extra dependencies
Expand Down
17 changes: 13 additions & 4 deletions examples/generative/gpt2_text_generation_with_kerasnlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
Description: Use KerasNLP GPT2 model and `samplers` to do text generation.
Accelerator: GPU
"""
"""

"""
In this tutorial, you will learn to use [KerasNLP](https://keras.io/keras_nlp/) to load a
pre-trained Large Language Model (LLM) - [GPT-2 model](https://openai.com/research/better-language-models)
(originally invented by OpenAI), finetune it to a specific text style, and
Expand All @@ -25,16 +25,25 @@
"""

"""
## Install KerasNLP and Import Dependencies
## Install KerasNLP, Choose Backend and Import Dependencies
This examples uses [Keras Core](https://keras.io/keras_core/) to work in any of
`"tensorflow"`, `"jax"` or `"torch"`. Support for Keras Core is baked into
KerasNLP, simply change the `"KERAS_BACKEND"` environment variable to select
the backend of your choice. We select the JAX backend below.
"""

"""shell
pip install -q keras-nlp
pip install git+https://github.com/keras-team/keras-nlp.git -q
"""

import os

os.environ["KERAS_BACKEND"] = "jax" # or "tensorflow" or "torch"

import keras_nlp
import tensorflow as tf
from tensorflow import keras
import keras_core as keras
import time

"""
Expand Down
17 changes: 13 additions & 4 deletions examples/generative/ipynb/gpt2_text_generation_with_kerasnlp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@
"colab_type": "text"
},
"source": [
"## Install KerasNLP and Import Dependencies"
"## Install KerasNLP, Choose Backend and Import Dependencies\n",
"\n",
"This examples uses [Keras Core](https://keras.io/keras_core/) to work in any of\n",
"`\"tensorflow\"`, `\"jax\"` or `\"torch\"`. Support for Keras Core is baked into\n",
"KerasNLP, simply change the `\"KERAS_BACKEND\"` environment variable to select\n",
"the backend of your choice. We select the JAX backend below."
]
},
{
Expand All @@ -58,7 +63,7 @@
},
"outputs": [],
"source": [
"!pip install -q keras-nlp"
"!pip install git+https://github.com/keras-team/keras-nlp.git -q"
]
},
{
Expand All @@ -69,9 +74,13 @@
},
"outputs": [],
"source": [
"import os\n",
"\n",
"os.environ[\"KERAS_BACKEND\"] = \"jax\" # or \"tensorflow\" or \"torch\"\n",
"\n",
"import keras_nlp\n",
"import tensorflow as tf\n",
"from tensorflow import keras\n",
"import keras_core as keras\n",
"import time"
]
},
Expand Down Expand Up @@ -656,4 +665,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
Loading

0 comments on commit 34a4dd1

Please sign in to comment.