Views
No views yet
pip install hf-hub-ctranslate2>=2.0.8 ctranslate2>=3.14.0ct2-transformers-converter --model bigcode/gpt_bigcode-santacoder --output_dir /home/michael/tmp-ct2fast-gpt_bigcode-santacoder --force --copy_files tokenizer.json README.md tokenizer_config.json special_tokens_map.json .gitattributes --quantization float16 --trust_remote_codecompute_type=int8_float16 for device="cuda"compute_type=int8 for device="cpu"1from hf_hub_ctranslate2 import TranslatorCT2fromHfHub, GeneratorCT2fromHfHub
2from transformers import AutoTokenizer
3
4model_name = "michaelfeil/ct2fast-gpt_bigcode-santacoder"
5# use either TranslatorCT2fromHfHub or GeneratorCT2fromHfHub here, depending on model.
6model = GeneratorCT2fromHfHub(
7 # load in int8 on CUDA
8 model_name_or_path=model_name,
9 device="cuda",
10 compute_type="int8_float16",
11 # tokenizer=AutoTokenizer.from_pretrained("bigcode/gpt_bigcode-santacoder")
12)
13outputs = model.generate(
14 text=["How do you call a fast Flan-ingo?", "User: How are you doing? Bot:"],
15 max_length=64,
16 include_prompt_in_result=False
17)
18print(outputs)
main: Uses the gpt_bigcode model. Requires the bigcode fork of transformers.main_custom: Packaged with its modeling code. Requires transformers>=4.27.
Alternatively, it can run on older versions by setting the configuration parameter activation_function = "gelu_pytorch_tanh".# the following function computes the sqrt) or write a function signature and docstring and let the model complete the function body.