VolkanSimsir commited on
Commit
9e7e702
·
verified ·
1 Parent(s): 798a428

Upload 3 files

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -1,9 +1,22 @@
1
  from fastapi import FastAPI
2
  from transformers import pipeline
 
 
3
 
4
  app = FastAPI()
5
 
6
- pipe = pipeline("text-generation", model="VolkanSimsir/LLaMA-3-8B-GRPO-math-tr")
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  @app.get("/")
9
  def home():
 
1
  from fastapi import FastAPI
2
  from transformers import pipeline
3
+ from transformers import AutoModelForCausalLM, BitsAndBytesConfig
4
+ import torch
5
 
6
  app = FastAPI()
7
 
8
+ bnb_config = BitsAndBytesConfig(
9
+ load_in_4bit=True,
10
+ bnb_4bit_quant_type="nf4",
11
+ bnb_4bit_compute_dtype=torch.float16
12
+ )
13
+
14
+ model = AutoModelForCausalLM.from_pretrained(
15
+ "VolkanSimsir/LLaMA-3-8B-GRPO-math-tr",
16
+ quantization_config=bnb_config,
17
+ torch_dtype=torch.float16,
18
+ device_map="auto"
19
+ )
20
 
21
  @app.get("/")
22
  def home():