monuminu commited on
Commit
81b60c0
1 Parent(s): 95f7077

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -0
README.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```model = AutoModelForCausalLM.from_pretrained(
2
+ model_name,
3
+ low_cpu_mem_usage=True,
4
+ return_dict=True,
5
+ torch_dtype=torch.float16,
6
+ device_map=device_map,
7
+ )
8
+ tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
9
+ prompt = "menulis esai tentang perekonomian indonesia"
10
+ pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, do_sample=True,
11
+ top_k=10,
12
+ num_return_sequences=1,
13
+ eos_token_id=tokenizer.eos_token_id,
14
+ max_length=1028, )
15
+ result = pipe(f"<s>[INST] {prompt} [/INST]")
16
+ print(result[0]['generated_text'])```