Spaces:
Runtime error
Runtime error
Fix generate process
Browse files- spanish_medica_llm.py +6 -3
spanish_medica_llm.py
CHANGED
@@ -25,7 +25,7 @@ from transformers import (
|
|
25 |
|
26 |
from accelerate import FullyShardedDataParallelPlugin, Accelerator
|
27 |
from torch.distributed.fsdp.fully_sharded_data_parallel import FullOptimStateDictConfig, FullStateDictConfig
|
28 |
-
from peft import LoraConfig, get_peft_model, prepare_model_for_kbit_training
|
29 |
#import wandb
|
30 |
from trl import SFTTrainer
|
31 |
|
@@ -735,8 +735,11 @@ def generate_response(query):
|
|
735 |
top_k=40
|
736 |
num_beams=2
|
737 |
|
738 |
-
|
739 |
-
|
|
|
|
|
|
|
740 |
|
741 |
#system = f"[INST]\nYou are a helpful coding assistant.[/INST]\n"
|
742 |
query = get_chat_format({'raw_text':query, 'topic':''})
|
|
|
25 |
|
26 |
from accelerate import FullyShardedDataParallelPlugin, Accelerator
|
27 |
from torch.distributed.fsdp.fully_sharded_data_parallel import FullOptimStateDictConfig, FullStateDictConfig
|
28 |
+
from peft import PeftConfig, LoraConfig, get_peft_model, prepare_model_for_kbit_training
|
29 |
#import wandb
|
30 |
from trl import SFTTrainer
|
31 |
|
|
|
735 |
top_k=40
|
736 |
num_beams=2
|
737 |
|
738 |
+
#model = loadBaseModel(HUB_MODEL_ID)
|
739 |
+
|
740 |
+
config = PeftConfig.from_pretrained(HUB_MODEL_ID)
|
741 |
+
model = AutoModelForCausalLM.from_pretrained(HUB_MODEL_ID, return_dict=True, load_in_8bit=True, device_map={"":0})
|
742 |
+
tokenizer = AutoTokenizer.from_pretrained(HUB_MODEL_ID)
|
743 |
|
744 |
#system = f"[INST]\nYou are a helpful coding assistant.[/INST]\n"
|
745 |
query = get_chat_format({'raw_text':query, 'topic':''})
|