Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Testing falcon for chat completion
  • Loading branch information
santiadavani committed Aug 7, 2023
commit 18537ab93f0eff20b18a377f5e43a019d73359ae
36 changes: 36 additions & 0 deletions pgml-apps/pgml-chat/pgml_chat/falcon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from pgml import Database
import os
from dotenv import load_dotenv
import asyncio
from rich.pretty import pprint
# Load .env file
load_dotenv(".env")

database_url = os.environ.get("DATABASE_URL")
db = Database(database_url)


async def main():
prompt = (
"Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
)
results = await db.transform(
task={
"task": "text-generation",
"model": "tiiuae/falcon-7b-instruct",
"trust_remote_code": True,
"torch_dtype": "bfloat16",
"device_map": "auto",
},
inputs=prompt,
args={
"temperature": 0.7,
"top_p": 0.9,
"max_length" : 256
},
)
pprint(results)


if __name__ == "__main__":
asyncio.run(main())