ariG23498 HF Staff commited on
Commit
9ef84db
·
verified ·
1 Parent(s): 06669b9

Upload custom_code/openbmb_MiniCPM4-8B.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. custom_code/openbmb_MiniCPM4-8B.py +19 -0
custom_code/openbmb_MiniCPM4-8B.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "transformers",
5
+ # "torch",
6
+ # ]
7
+ # ///
8
+
9
+ # Use a pipeline as a high-level helper
10
+ from transformers import pipeline
11
+
12
+ pipe = pipeline("text-generation", model="openbmb/MiniCPM4-8B", trust_remote_code=True)
13
+ messages = [
14
+ {"role": "user", "content": "Who are you?"},
15
+ ]
16
+ pipe(messages)
17
+ # Load model directly
18
+ from transformers import AutoModelForCausalLM
19
+ model = AutoModelForCausalLM.from_pretrained("openbmb/MiniCPM4-8B", trust_remote_code=True)