gushoubang 8 сар өмнө
parent
commit
aea458f8fe

+ 0 - 32
1.py

@@ -1,32 +0,0 @@
-from modelscope import AutoModelForCausalLM, AutoTokenizer
-device = "cuda" # the device to load the model onto
- 
-model = AutoModelForCausalLM.from_pretrained(
-    "qwen/Qwen2-7B",
-    torch_dtype="auto",
-    device_map="auto"
-)
-tokenizer = AutoTokenizer.from_pretrained("qwen/Qwen2-7B")
- 
-prompt = "Give me a short introduction to large language model."
-messages = [
-    {"role": "system", "content": "You are a helpful assistant."},
-    {"role": "user", "content": prompt}
-]
-text = tokenizer.apply_chat_template(
-    messages,
-    tokenize=False,
-    add_generation_prompt=True
-)
-model_inputs = tokenizer([text], return_tensors="pt").to(device)
- 
-generated_ids = model.generate(
-    model_inputs.input_ids,
-    max_new_tokens=512
-)
-generated_ids = [
-    output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
-]
- 
-response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
-print(response)

BIN
__pycache__/modelscope.cpython-310.pyc


BIN
__pycache__/modelscope.cpython-38.pyc


+ 3 - 3
app.py

@@ -134,8 +134,8 @@ def inputMsg():
 
     try:                                                                                                             
         res = ollama.generate(
-            # model="qwen2:7b",
-            model="gemma2:27b",
+            model="qwen2:7b",
+            # model="gemma2:27b",
             stream=False,
             prompt=prompt,
             options={"temperature": 0},
@@ -222,7 +222,7 @@ def jsonResToDict(json_res):
                 "spatial_type": conditionObj["spatial_type"],
                 "default": factor["condition"],
                 "hasValue": conditionObj["hasValue"],
-                "defaultValue": factor["value"],
+                "defaultValue": str(factor["value"]),
                 "unit": conditionObj["unit"],
                 "clip": conditionObj["clip"]
             }

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 46
ceshi copy.py


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 45
ceshi.py


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно