Tonic commited on
Commit
2b68362
·
verified ·
1 Parent(s): ca6eb64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -14,7 +14,7 @@ You can also use 🐣e5-mistral🛌🏻 by cloning this space. 🧬🔬🔍 Simp
14
  Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder's🛠️community on 👻Discord: [![Let's build the future of AI together! 🚀🤖](https://discordapp.com/api/guilds/1109943800132010065/widget.png)](https://discord.gg/GWpVpekp) On 🤗Huggingface: [TeamTonic](https://huggingface.co/TeamTonic) & [MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Polytonic](https://github.com/tonic-ai) & contribute to 🌟 [Poly](https://github.com/tonic-ai/poly)
15
  """
16
 
17
- # os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:50'
18
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
19
 
20
  # torch.backends.cuda.matmul.allow_tf32 = True
@@ -37,7 +37,7 @@ def get_detailed_instruct(task_description: str, query: str) -> str:
37
  @spaces.GPU
38
  def compute_embeddings(*input_texts):
39
  tokenizer = AutoTokenizer.from_pretrained('intfloat/e5-mistral-7b-instruct')
40
- model = AutoModel.from_pretrained('intfloat/e5-mistral-7b-instruct', torch_dtype="auto", device_map=device))
41
  max_length = 4096
42
  task = 'Given a web search query, retrieve relevant passages that answer the query'
43
  processed_texts = [get_detailed_instruct(task, text) for text in input_texts]
 
14
  Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder's🛠️community on 👻Discord: [![Let's build the future of AI together! 🚀🤖](https://discordapp.com/api/guilds/1109943800132010065/widget.png)](https://discord.gg/GWpVpekp) On 🤗Huggingface: [TeamTonic](https://huggingface.co/TeamTonic) & [MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Polytonic](https://github.com/tonic-ai) & contribute to 🌟 [Poly](https://github.com/tonic-ai/poly)
15
  """
16
 
17
+ os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:50'
18
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
19
 
20
  # torch.backends.cuda.matmul.allow_tf32 = True
 
37
  @spaces.GPU
38
  def compute_embeddings(*input_texts):
39
  tokenizer = AutoTokenizer.from_pretrained('intfloat/e5-mistral-7b-instruct')
40
+ model = AutoModel.from_pretrained('intfloat/e5-mistral-7b-instruct', torch_dtype="auto", device_map=device)
41
  max_length = 4096
42
  task = 'Given a web search query, retrieve relevant passages that answer the query'
43
  processed_texts = [get_detailed_instruct(task, text) for text in input_texts]