Spaces:
Sleeping
Sleeping
File size: 2,385 Bytes
4583695 |
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from BART_utils import get_prob, judge_mbti, compute_score, mbti_translator, device\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\sukhy\\.virtualenvs\\mbti_translator_demo-C9tdDvXD\\lib\\site-packages\\transformers\\tokenization_utils_base.py:2284: FutureWarning: The `truncation_strategy` argument is deprecated and will be removed in a future version, use `truncation=True` to truncate examples to a max length. You can give a specific length with `max_length` (e.g. `max_length=45`) or leave max_length to None to truncate to the maximal input size of the model (e.g. 512 for Bert). If you have pairs of inputs, you can give a specific truncation strategy selected among `truncation='only_first'` (will only truncate the first sentence in the pairs) `truncation='only_second'` (will only truncate the second sentence in the pairs) or `truncation='longest_first'` (will iteratively remove tokens from the longest sentence in the pairs).\n",
" warnings.warn(\n"
]
},
{
"data": {
"text/plain": [
"('ISTP',\n",
" ({'E': 29.336015080590734, 'I': 70.66398491940927},\n",
" {'N': 25.69581522631164, 'S': 74.30418477368836},\n",
" {'T': 50.32619548200952, 'F': 49.67380451799048},\n",
" {'P': 56.57599646556062, 'J': 43.42400353443938}))"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"text=\"I Stayed home all day\"\n",
"mbti_translator(text)"
]
}
],
"metadata": {
"interpreter": {
"hash": "ca045e0e82b80c80cdacb54c8a532995176e76269958f022629c504a9c392a37"
},
"kernelspec": {
"display_name": "Python 3.9.6 ('mbti_bart-OwFxlXtE')",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
|