Pendrokar commited on
Commit
ed24bc1
·
1 Parent(s): afabdf2

fine, i'll set my own cache dir

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -3,7 +3,6 @@ from __future__ import print_function, division, unicode_literals
3
  import gradio as gr
4
 
5
  import sys
6
- from os import environ
7
  from os.path import abspath, dirname
8
 
9
  import json
@@ -13,9 +12,9 @@ from torchmoji.sentence_tokenizer import SentenceTokenizer
13
  from torchmoji.model_def import torchmoji_emojis
14
  from transformers import AutoModel, AutoTokenizer
15
  model_name = "Pendrokar/TorchMoji"
16
- model = AutoModel.from_pretrained(model_name)
17
  tokenizer = AutoTokenizer.from_pretrained(model_name)
18
- model_path = environ['HF_HUB_CACHE'] + "{model_name}/pytorch_model.bin"
19
  vocab_path = './' + model_name + "/vocabulary.json"
20
 
21
  def top_elements(array, k):
 
3
  import gradio as gr
4
 
5
  import sys
 
6
  from os.path import abspath, dirname
7
 
8
  import json
 
12
  from torchmoji.model_def import torchmoji_emojis
13
  from transformers import AutoModel, AutoTokenizer
14
  model_name = "Pendrokar/TorchMoji"
15
+ model = AutoModel.from_pretrained(model_name, cache_dir="~/.cache/huggingface/hub/")
16
  tokenizer = AutoTokenizer.from_pretrained(model_name)
17
+ model_path = "~/.cache/huggingface/hub/{model_name}/pytorch_model.bin"
18
  vocab_path = './' + model_name + "/vocabulary.json"
19
 
20
  def top_elements(array, k):