Create README.md
Browse files
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'])```
|