Mario12355 commited on
Commit
f90e5fd
·
1 Parent(s): 3ff6b4c
Files changed (2) hide show
  1. app.py +10 -7
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1,18 +1,21 @@
1
  import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
3
  import torch
 
4
 
5
  # Modell und Tokenizer laden
6
  model_name = "Mario12355/llama_3.1_20.11_fini_dpo"
7
- tokenizer = AutoTokenizer.from_pretrained(model_name)
8
- model = AutoModelForCausalLM.from_pretrained(
9
- model_name,
10
- torch_dtype=torch.float16,
11
- device_map="auto"
12
  )
13
 
14
  # Dein Alpaca-Prompt Template
15
- alpaca_prompt = """### Instruction:
 
 
16
  {}
17
 
18
  ### Input:
@@ -73,7 +76,7 @@ demo = gr.ChatInterface(
73
  ),
74
  gr.Slider(
75
  minimum=32,
76
- maximum=2048,
77
  value=128,
78
  step=32,
79
  label="Maximale Anzahl neuer Tokens"
 
1
  import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
3
  import torch
4
+ from unsloth import FastLanguageModel
5
 
6
  # Modell und Tokenizer laden
7
  model_name = "Mario12355/llama_3.1_20.11_fini_dpo"
8
+ model, tokenizer = FastLanguageModel.from_pretrained(
9
+ model_name = model_name,
10
+ max_seq_length = 2048,
11
+ dtype = None,
12
+ load_in_4bit = True,
13
  )
14
 
15
  # Dein Alpaca-Prompt Template
16
+ alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
17
+
18
+ ### Instruction:
19
  {}
20
 
21
  ### Input:
 
76
  ),
77
  gr.Slider(
78
  minimum=32,
79
+ maximum=256,
80
  value=128,
81
  step=32,
82
  label="Maximale Anzahl neuer Tokens"
requirements.txt CHANGED
@@ -4,4 +4,5 @@ transformers>=4.36.0
4
  torch>=2.0.0
5
  accelerate>=0.26.0
6
  sentencepiece
7
- protobuf
 
 
4
  torch>=2.0.0
5
  accelerate>=0.26.0
6
  sentencepiece
7
+ protobuf
8
+ unsloth