Locutusque commited on
Commit
daecaae
1 Parent(s): e34e174

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -3,17 +3,19 @@ from transformers import pipeline
3
  import torch
4
  import subprocess
5
  import spaces
 
6
 
7
 
8
  # Install flash-attn
9
  subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
10
  # Initialize the model pipeline
11
- generator = pipeline('text-generation', model='mistralai/Mistral-7B-v0.1', torch_dtype=torch.bfloat16)
12
  @spaces.GPU
13
  def generate_text(prompt, temperature, top_p, top_k, repetition_penalty, max_length):
14
  # Generate text using the model
15
  generator.model.cuda()
16
  generator.device = torch.device("cuda")
 
17
  outputs = generator(
18
  prompt,
19
  do_sample=True,
@@ -41,8 +43,8 @@ iface = gr.Interface(
41
  gr.Slider(minimum=5, maximum=4096, step=5, value=1024, label="Max Length")
42
  ],
43
  outputs=gr.Textbox(label="Generated Text"),
44
- title="Text Completion Model",
45
- description="Try out the Mistral-7B model for free! Note this is the pretrained model and is not fine-tuned for instruction."
46
  )
47
 
48
  iface.launch()
 
3
  import torch
4
  import subprocess
5
  import spaces
6
+ import os
7
 
8
 
9
  # Install flash-attn
10
  subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
11
  # Initialize the model pipeline
12
+ generator = pipeline('text-generation', model='Locutusque/Hyperion-1.5-Mistral-7B', torch_dtype=torch.bfloat16, token=os.environ["HF"])
13
  @spaces.GPU
14
  def generate_text(prompt, temperature, top_p, top_k, repetition_penalty, max_length):
15
  # Generate text using the model
16
  generator.model.cuda()
17
  generator.device = torch.device("cuda")
18
+ prompt = f"<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
19
  outputs = generator(
20
  prompt,
21
  do_sample=True,
 
43
  gr.Slider(minimum=5, maximum=4096, step=5, value=1024, label="Max Length")
44
  ],
45
  outputs=gr.Textbox(label="Generated Text"),
46
+ title="Hyperion-1.5-Mistral-7B",
47
+ description="Try out the Hyperion-1.5-Mistral-7B model for free! This is a preview version, and the model will be released soon"
48
  )
49
 
50
  iface.launch()