You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
app.py loads every time from new the model intro ram, by press Get Answer, best way will be load model then just Get Answer and model stays in ram if project become big like gpt-j6B model must stay loaded in ram then Get Answer
#-----------------------------------------------------------------
#-something like this but model must stay in ram for every answer
import torch
import streamlit as st
from transformers import GPT2Tokenizer, GPT2LMHeadModel
app.py loads every time from new the model intro ram, by press Get Answer, best way will be load model then just Get Answer and model stays in ram if project become big like gpt-j6B model must stay loaded in ram then Get Answer
#-----------------------------------------------------------------
#-something like this but model must stay in ram for every answer
import torch
import streamlit as st
from transformers import GPT2Tokenizer, GPT2LMHeadModel
tokenizer = GPT2Tokenizer.from_pretrained("gagan3012/project-code-py-small" , low_ram_method = True, use_cache=True, use_fast=True, low_cpu_mem_usage = True)
model = GPT2LMHeadModel.from_pretrained("gagan3012/project-code-py-small")
#-step to keep tokenizer and model loaded at this point
st.set_page_config(
page_title="AI Leetcode",
layout="wide",
initial_sidebar_state="expanded", )
...
The text was updated successfully, but these errors were encountered: