Spaces:
Runtime error
Runtime error
YangHao520
commited on
Commit
·
e26a27e
1
Parent(s):
5b85931
Update GetToken.py
Browse files- GetToken.py +8 -0
GetToken.py
CHANGED
@@ -1,3 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import tiktoken
|
2 |
# 计算 encode 返回列表的长度
|
3 |
def num_tokens_from_messages(messages, model="gpt-3.5-turbo-0301"):
|
|
|
1 |
+
# !/usr/bin/env python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
"""
|
4 |
+
Copyright reserved by Yang Hao, Metaverse Developers Association. All rights reserved
|
5 |
+
Calculate Token
|
6 |
+
Authors: yanghao(yanghao31@baidu.com)
|
7 |
+
Date: 2023/09/12 19:23:06
|
8 |
+
"""
|
9 |
import tiktoken
|
10 |
# 计算 encode 返回列表的长度
|
11 |
def num_tokens_from_messages(messages, model="gpt-3.5-turbo-0301"):
|