tushar-r-pawar commited on
Commit
617e23e
1 Parent(s): 4db5e4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -2,7 +2,7 @@ import torch
2
  import streamlit as st
3
  import os
4
  from dotenv import load_dotenv
5
- from airllm import AutoModel
6
  from transformers import AutoTokenizer, GenerationConfig
7
 
8
  # Load environment variables
@@ -14,7 +14,13 @@ api_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
14
  # Initialize model and tokenizer
15
  MAX_LENGTH = 128
16
  model_name = "internlm/internlm2_5-7b"
17
- model = AutoModel.from_pretrained(model_name)
 
 
 
 
 
 
18
  tokenizer = AutoTokenizer.from_pretrained(model_name)
19
 
20
  # Streamlit app configuration
 
2
  import streamlit as st
3
  import os
4
  from dotenv import load_dotenv
5
+ from airllm import AutoModel,AirLLMInternLM
6
  from transformers import AutoTokenizer, GenerationConfig
7
 
8
  # Load environment variables
 
14
  # Initialize model and tokenizer
15
  MAX_LENGTH = 128
16
  model_name = "internlm/internlm2_5-7b"
17
+ try:
18
+ model = AirLLMInternLM.from_pretrained(model_name)
19
+ except:
20
+ try:
21
+ model=AirLLMInternLM(model_name)
22
+ except:
23
+ model=AutoModel.from_pretrained(model_name)
24
  tokenizer = AutoTokenizer.from_pretrained(model_name)
25
 
26
  # Streamlit app configuration