Skip to content

Commit b4adb07

Browse files
committed
add google colab
1 parent ef06854 commit b4adb07

File tree

2 files changed

+100
-1
lines changed

2 files changed

+100
-1
lines changed

GPT2_Pytorch.ipynb

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 0,
4+
"metadata": {
5+
"colab": {
6+
"name": "GPT2-Pytorch.ipynb",
7+
"version": "0.3.2",
8+
"provenance": [],
9+
"collapsed_sections": []
10+
},
11+
"kernelspec": {
12+
"name": "python3",
13+
"display_name": "Python 3"
14+
},
15+
"accelerator": "GPU"
16+
},
17+
"cells": [
18+
{
19+
"metadata": {
20+
"id": "4L7HpNaFHO5D",
21+
"colab_type": "code",
22+
"outputId": "a97fd9ea-0390-473c-f96a-2b0e32e70cca",
23+
"colab": {
24+
"base_uri": "https://localhost:8080/",
25+
"height": 373
26+
}
27+
},
28+
"cell_type": "code",
29+
"source": [
30+
"!git clone https://github.com/graykode/gpt-2-Pytorch\n",
31+
"%cd gpt-2-Pytorch\n",
32+
"!curl --output gpt2-pytorch_model.bin https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-pytorch_model.bin\n",
33+
"!pip install -r requirements.txt"
34+
],
35+
"execution_count": 1,
36+
"outputs": [
37+
{
38+
"output_type": "stream",
39+
"text": [
40+
"Cloning into 'gpt-2-Pytorch'...\n",
41+
"remote: Enumerating objects: 51, done.\u001b[K\n",
42+
"remote: Counting objects: 100% (51/51), done.\u001b[K\n",
43+
"remote: Compressing objects: 100% (40/40), done.\u001b[K\n",
44+
"remote: Total 51 (delta 15), reused 44 (delta 9), pack-reused 0\u001b[K\n",
45+
"Unpacking objects: 100% (51/51), done.\n",
46+
"/content/gpt-2-Pytorch\n",
47+
" % Total % Received % Xferd Average Speed Time Time Time Current\n",
48+
" Dload Upload Total Spent Left Speed\n",
49+
"100 522M 100 522M 0 0 77.7M 0 0:00:06 0:00:06 --:--:-- 81.3M\n",
50+
"Collecting fire>=0.1.3 (from -r requirements.txt (line 1))\n",
51+
" Downloading https://files.pythonhosted.org/packages/5a/b7/205702f348aab198baecd1d8344a90748cb68f53bdcd1cc30cbc08e47d3e/fire-0.1.3.tar.gz\n",
52+
"Collecting regex==2017.4.5 (from -r requirements.txt (line 2))\n",
53+
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/36/62/c0c0d762ffd4ffaf39f372eb8561b8d491a11ace5a7884610424a8b40f95/regex-2017.04.05.tar.gz (601kB)\n",
54+
"\u001b[K 100% |████████████████████████████████| 604kB 26.2MB/s \n",
55+
"\u001b[?25hCollecting gpt2-pytorch_model.bin (from -r requirements.txt (line 3))\n",
56+
"\u001b[31m Could not find a version that satisfies the requirement gpt2-pytorch_model.bin (from -r requirements.txt (line 3)) (from versions: )\u001b[0m\n",
57+
"\u001b[31mNo matching distribution found for gpt2-pytorch_model.bin (from -r requirements.txt (line 3))\u001b[0m\n"
58+
],
59+
"name": "stdout"
60+
}
61+
]
62+
},
63+
{
64+
"metadata": {
65+
"id": "he_YiEC9T6-D",
66+
"colab_type": "code",
67+
"colab": {
68+
"base_uri": "https://localhost:8080/",
69+
"height": 205
70+
},
71+
"outputId": "58e3f04e-905a-4adf-fd0c-98c682abe9d2"
72+
},
73+
"cell_type": "code",
74+
"source": [
75+
"!python main.py --text \"Once when I was six years old I saw a magnificent picture in a book, called True Stories from Nature, about the primeval forest.\""
76+
],
77+
"execution_count": 2,
78+
"outputs": [
79+
{
80+
"output_type": "stream",
81+
"text": [
82+
"Namespace(batch_size=-1, length=-1, nsamples=1, seed=0, temperature=1, text='Once when I was six years old I saw a magnificent picture in a book, called True Stories from Nature, about the primeval forest.', top_k=0, unconditional=False)\n",
83+
"Once when I was six years old I saw a magnificent picture in a book, called True Stories from Nature, about the primeval forest.\n",
84+
"[7454, 618, 314, 373, 2237, 812, 1468, 314, 2497, 257, 25023, 4286, 287, 257, 1492, 11, 1444, 6407, 18152, 422, 10362, 11, 546, 262, 6994, 2100, 8222, 13]\n",
85+
"100% 512/512 [00:12<00:00, 40.58it/s]\n",
86+
"======================================== SAMPLE 1 ========================================\n",
87+
" I didn't know about it until a few months later when comparing the figure of ichthyosis emblazoned on a top of mushroom scales with misinformation spread by reputable population labs that discovered breeders of various breeds and classes of plants that are more closely related to these plants than others, at least according to their interpretation of what was being observed, very closely adapted to replace the need for the invasive species, hence the perception that only some had even arrived where the original frontier dogs would not. A few good photos were taken of lumps hooked around short arelets, showing far more frequently than others. The large puff-thraps (chloroxy pickshares) that have grown up very near Mare Crosloquifroides: a species using the word to export its products frepeace, far more than it had acquired at Mare Crosloquifroides. The coffee fennel (pelleaphrotechus) has got several, distinct markings in particular. The pinks were some from bloom and others from tame stages. Again, almost, all the people of these flocks experienced this species on an uneventful day.\n",
88+
"\n",
89+
"It strays to the story of Brammas Nostalgia made popular by that particular years-old-islet. It told a incurable and unfathomable story about strong women abused without violence or the death call of the grand poet who so loved an East Asian wife in spite of violent boyfriends who'd filiated her, destroyed wife, and threatened her on the street (and still \"Rammas Sadasta\" period) with a triangle wrapped around her finger, which the common thief would wrap around an animal's hand, regardless of true love or it to shaving half of her bitten pink cat's back, and would wrap herself in a stuffed dog-sweat sack that Kimi visited when she went to America with a crush on her black-muscled shoes or on her Manchester level Stade de Pau (Date Of Birth). The Lions Superinformations Black Pockets grew on pilgrimage to Calais somewhere to see help those soldiers and stay quiet about raging racism in our cities really makper up such stories as did Brammas Nostalgia. That all comes off as too romantic to be true in Molly Szierabich's novel Rhizopus. Remember the liberal megalopolis in BBC World-Herald Affair where the infamous Milo Yiannopoulos extravaganza featured such scenes? That do it now as a museum in Museum de Citat? It was set to\n",
90+
"================================================================================\n"
91+
],
92+
"name": "stdout"
93+
}
94+
]
95+
}
96+
]
97+
}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ $ curl --output gpt2-pytorch_model.bin https://s3.amazonaws.com/models.huggingfa
2929
$ pip install -r requirements.txt
3030
```
3131

32-
Now, You can run like this.
32+
2. Now, You can run like this.
3333

3434
```shell
3535
$ python main.py --text "Once when I was six years old I saw a magnificent picture in a book, called True Stories from Nature, about the primeval forest."
3636
```
3737

38+
3. Also You can Quick Start in [Google Colab](https://colab.research.google.com/github/graykode/gpt-2-Pytorch/blob/master/GPT2_Pytorch.ipynb)
39+
3840

3941

4042
## Option

0 commit comments

Comments
 (0)