Spaces:
Sleeping
Sleeping
Download app.py from KyBen/test_space_2: direct link, hf CLI and curl.
- Browser
- Download file 507 Bytes
-
https://huggingface.co/spaces/KyBen/test_space_2/resolve/main/app.py
- Command line
-
hf download hf://spaces/KyBen/test_space_2/app.py
-
curl -L -o app.py https://huggingface.co/spaces/KyBen/test_space_2/resolve/main/app.py
507 Bytes
| """ | |
| from transformers import AutoTokenizer, LlamaForCausalLM | |
| model = LlamaForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS) | |
| tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER) | |
| prompt = "Hey, are you conscious? Can you talk to me?" | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| # Generate | |
| generate_ids = model.generate(inputs.input_ids, max_length=30) | |
| tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0] | |
| """ | |
| print("Hello World!") |