Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created some models #10

Merged
merged 11 commits into from
Sep 27, 2023
Merged

Created some models #10

merged 11 commits into from
Sep 27, 2023

Conversation

AragonerUA
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@F47-503 F47-503 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main request is to move models to gpu before inference

model = AutoModel.from_pretrained("daryl149/llama-2-7b-chat-hf")


# tokenizer = LlamaTokenizer.from_pretrained("/output/path")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better do not leave commented unused code like this

models/huggingface_models.py Outdated Show resolved Hide resolved
models/huggingface_models.py Outdated Show resolved Hide resolved
models/huggingface_models.py Outdated Show resolved Hide resolved
pipeline = transformers.pipeline(
"text-generation",
model=model,
torch_dtype=torch.float16,
Copy link
Member

@bzz bzz Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use torch.bfloat16 but still that would be ~12Gb

I've used int4 quantisation

    nf4_config = BitsAndBytesConfig(
        load_in_4bit=True,
        bnb_4bit_quant_type="nf4",
        bnb_4bit_use_double_quant=True,
        bnb_4bit_compute_dtype=torch.bfloat16
    )
    model_nf4 = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=nf4_config)
    tokenizer = AutoTokenizer.from_pretrained(model_name)

    pipeline = transformers.pipeline(
        "text-generation",
        model=model_nf4,
        torch_dtype=torch.bfloat16,
        tokenizer=tokenizer
    )

AragonerUA and others added 5 commits September 14, 2023 19:04
The reason why I cannot test locally - I have Metal architecture. The most common error is the inability to use int4 in Metal, but it is used in model implementation, so I simply have not got access to this part of the code.
BitsAndBytes, without local testing
@bzz
Copy link
Member

bzz commented Sep 15, 2023

ATM this can not be merged until the conflicts are resolved.

Copy link
Member

@bzz bzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@bzz bzz merged commit a428958 into main Sep 27, 2023
3 of 4 checks passed
@bzz bzz deleted the models branch September 27, 2023 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants