Skip to content

Commit

Permalink
added decorator to generate action (#69)
Browse files Browse the repository at this point in the history
* added decorator to generate action

* changed decoration to prepare_model
  • Loading branch information
Jasonqi146 authored Apr 29, 2024
1 parent cad4701 commit d762753
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sotopia_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import TypeVar
from functools import cache
import logging
import json

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
Expand Down Expand Up @@ -38,6 +37,7 @@
log = logging.getLogger("generate")
logging_handler = LoggingCallbackHandler("langchain")

# @spaces.GPU
def generate_action(
model_name: str,
history: str,
Expand Down Expand Up @@ -82,6 +82,7 @@ def generate_action(
# print(e)
# return AgentAction(action_type="none", argument="")

@spaces.GPU(duration=1200)
@cache
def prepare_model(model_name):
compute_type = torch.float16
Expand Down

0 comments on commit d762753

Please sign in to comment.