Skip to content

Commit

Permalink
Created using Colaboratory
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaibhavs10 committed Apr 9, 2024
1 parent aff4324 commit a169611
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions CodeGemma_colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3858,27 +3858,6 @@
"id": "k95vA7tEz3XO"
}
},
{
"cell_type": "code",
"source": [
"# pip install accelerate\n",
"from transformers import GemmaTokenizer, AutoModelForCausalLM\n",
"\n",
"tokenizer = GemmaTokenizer.from_pretrained(\"google/codegemma-7b-it\")\n",
"model = AutoModelForCausalLM.from_pretrained(\"google/codegemma-7b-it\")\n",
"\n",
"input_text = \"Write a Python function to calculate the nth fibonacci number.\\n\"\n",
"input_ids = tokenizer(input_text, return_tensors=\"pt\")\n",
"\n",
"outputs = model.generate(**input_ids)\n",
"print(tokenizer.decode(outputs[0]))"
],
"metadata": {
"id": "m3u4T5PSfhuE"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -4173,7 +4152,7 @@
"from transformers import GemmaTokenizer, AutoModelForCausalLM\n",
"import torch\n",
"\n",
"model_id = \"gg-hf/codegemma-2b\"\n",
"model_id = \"google/codegemma-2b\"\n",
"\n",
"tokenizer = GemmaTokenizer.from_pretrained(model_id)\n",
"model = AutoModelForCausalLM.from_pretrained(\n",
Expand Down

0 comments on commit a169611

Please sign in to comment.