File size: 1,168 Bytes
34e9d48
 
 
 
9ff10ae
e120c09
9ff10ae
27ff1f5
 
 
 
 
 
 
 
 
 
 
0f04f5f
27ff1f5
0f04f5f
27ff1f5
 
9ff10ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os, logging, torch, streamlit as st
from transformers import (
    AutoTokenizer, AutoModelForCausalLM)
st.balloons()

device = 'cpu'

@st.cache
def model_init():
    tokenizer = AutoTokenizer.from_pretrained(
        "ckip-joint/bloom-1b1-zh")
    model = AutoModelForCausalLM.from_pretrained(
        "ckip-joint/bloom-1b1-zh",
        # Ref.: Eric, Thanks!
        # torch_dtype="auto", 
        # device_map="auto",
    # Ref. for `half`: Chan-Jan, Thanks!
    ).eval().to(device)
    return tokenizer, model

tokenizer, model = model_init()

st.text(str(repr(model)))

# DONE 6.1s

# ===== Application Startup at 2023-02-23 17:51:48 =====

# 2023-02-23 18:52:26.009 INFO    matplotlib.font_manager: generated new fontManager

# Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.


#   You can now view your Streamlit app in your browser.

#   Network URL: http://10.19.49.246:8501
#   External URL: http://34.197.127.12:8501


#   A new version of Streamlit is available.

#   See what's new at https://discuss.streamlit.io/c/announcements

#   Enter the following command to upgrade:
#   $ pip install streamlit --upgrade